summaryrefslogtreecommitdiffstats
path: root/Codec/MIME/QuotedPrintable.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@galois.com>2008-01-04 16:23:04 -0800
committerDon Stewart <dons@galois.com>2008-01-04 16:23:04 -0800
commit35f0f40cfabeb49b468c6ae3c68fedded145a022 (patch)
tree0d4fa2b367a987c86ef5c14a06b7b91aee2dc6a7 /Codec/MIME/QuotedPrintable.hs
parent62e3911810c18e77a13794cb5899a9ebc6b0bbb3 (diff)
Move MIME stuff into proper Codec.* namespace.
Add copyrights where missing.
Diffstat (limited to 'Codec/MIME/QuotedPrintable.hs')
-rw-r--r--Codec/MIME/QuotedPrintable.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Codec/MIME/QuotedPrintable.hs b/Codec/MIME/QuotedPrintable.hs
new file mode 100644
index 0000000..514ce4e
--- /dev/null
+++ b/Codec/MIME/QuotedPrintable.hs
@@ -0,0 +1,12 @@
+module MIME.QuotedPrintable where
+
+import Data.Char
+
+decode :: String -> String
+decode "" = ""
+decode ('=':x1:x2:xs)
+ | isHexDigit x1 && isHexDigit x2 =
+ chr (digitToInt x1 * 16 + digitToInt x2) : decode xs
+decode ('=':xs) = '=':decode xs
+ -- make it explicit that we propagate other '=' occurrences.
+decode (x1:xs) = x1:decode xs