Skip to content

Commit

Permalink
support utf-8 in unstructured headers
Browse files Browse the repository at this point in the history
Partial support for RFC 6532.  For now, only unstructured headers
(e.g. Subject) allow UTF-8.

Fixes: #82
  • Loading branch information
frasertweedale committed Oct 25, 2024
1 parent 5fefbdd commit b777bea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Data/IMF.hs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ import Data.IMF.Syntax
( CI, ci, mk, original
, (<<>>), foldMany, foldMany1Sep
, char, fromChar, isAtext, isQtext, isVchar, isWsp
, optionalCFWS, word, wsp, vchar, optionalFWS, crlf
, optionalCFWS, word, wsp, vcharUtf8, optionalFWS, crlf
, domainLiteral, dotAtom, dotAtomText, localPart, quotedString
)
import {-# SOURCE #-} Data.IMF.Text (readMailbox)
Expand Down Expand Up @@ -899,9 +899,10 @@ field = (,)
<* char8 ':' <* many wsp
<*> unstructured <* crlf

-- | UTF-8 unstructured text
unstructured :: Parser B.ByteString
unstructured =
foldMany (optionalFWS <<>> (B.singleton <$> vchar))
foldMany (optionalFWS <<>> fmap B.pack vcharUtf8)
<<>> A.takeWhile isWsp


Expand Down

0 comments on commit b777bea

Please sign in to comment.