summaryrefslogtreecommitdiffstats
path: root/Codec/MIME/QuotedPrintable.hs
blob: 514ce4eb5916ef759904773e94b353413023f396 (plain)
1
2
3
4
5
6
7
8
9
10
11
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