blob: d6c058e9dd151b667d6211d4e924193188e8fc3d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--------------------------------------------------------------------
-- |
-- Module : Codec.MIME.QuotedPrintable
-- Copyright : (c) Galois, Inc. 2008
-- License : BSD3
--
-- Maintainer:
-- Stability : provisional
-- Portability:
--
--------------------------------------------------------------------
module Codec.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
|