summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Much/ParseMail.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Much/ParseMail.hs b/src/Much/ParseMail.hs
index e12737a..d9bb733 100644
--- a/src/Much/ParseMail.hs
+++ b/src/Much/ParseMail.hs
@@ -281,11 +281,15 @@ encodedWord =
return
$ T.decodeUtf8
$ BS8.pack
- $ QP.decode
- -- ^ TODO this current doesn't decode
- -- underscore to space
- $ map (\c -> if c == '_' then ' ' else c)
+ $ decodeQ
$ w
+ where
+ -- RFC 2047, 4.2. The "Q" encoding
+ decodeQ =
+ QP.decode . replace '_' ' '
+
+ replace a b =
+ map $ \c -> if c == a then b else c
-- word = encoded-word / atom / quoted-string