summaryrefslogtreecommitdiffstats
path: root/MIME/QuotedPrintable.hs
diff options
context:
space:
mode:
authorIavor S. Diatchki <diatchki@galois.com>2007-12-21 11:39:47 -0800
committerIavor S. Diatchki <diatchki@galois.com>2007-12-21 11:39:47 -0800
commitb99baac33e68d5603d0aa9ef699460a7e6a15c1d (patch)
treef4b0a8bd1a49dec75caab397fddff2a194a0aa00 /MIME/QuotedPrintable.hs
Initial import.
Diffstat (limited to 'MIME/QuotedPrintable.hs')
-rw-r--r--MIME/QuotedPrintable.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/MIME/QuotedPrintable.hs b/MIME/QuotedPrintable.hs
new file mode 100644
index 0000000..514ce4e
--- /dev/null
+++ b/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