From b99baac33e68d5603d0aa9ef699460a7e6a15c1d Mon Sep 17 00:00:00 2001 From: "Iavor S. Diatchki" Date: Fri, 21 Dec 2007 11:39:47 -0800 Subject: Initial import. --- MIME/QuotedPrintable.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 MIME/QuotedPrintable.hs (limited to 'MIME/QuotedPrintable.hs') 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 -- cgit v1.2.3