-- | Decode Content-Transfer-Encoding Qouted-Printable module Dqp(decodeQuotedPrintable) where import Data.Char(chr,isHexDigit,digitToInt) decodeQuotedPrintable :: String -> String decodeQuotedPrintable = dqp dqp [] = [] dqp ('=':'\r':'\n':cs) = dqp cs dqp ('=':'\n':cs) = dqp cs dqp ('=':c1:c2:cs) | isHexDigit c1 && isHexDigit c2 = hex c1 c2:dqp cs dqp (c:cs) = c:dqp cs hex c1 c2 = chr (16*digitToInt c1 + digitToInt c2)