Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data.IMF.Text (address) can't parse non-ascii characters #87

Open
romanofski opened this issue Jan 1, 2025 · 0 comments · May be fixed by #88
Open

Data.IMF.Text (address) can't parse non-ascii characters #87

romanofski opened this issue Jan 1, 2025 · 0 comments · May be fixed by #88

Comments

@romanofski
Copy link
Member

Looking into purebred-mua/purebred#515 I've thought of using Data.IMF.Text for the mutt alias parsing. However I think it can't handle non-ascii characters in the display name.

The current definition is

phrase :: Parser T.Text
phrase = foldMany1Sep (singleton ' ') word

while word is defined as:

isAtext :: IsChar c => c -> Bool
isAtext = AText.inClass "-A-Za-z0-9!#$%&'*+/=?^_`{|}~" . toChar

atext :: CharParsing f s a => (f s) a
atext = satisfy isAtext

atom :: (Alternative (f s), CharParsing f s a, SM s) => (f s) s
atom = optionalCFWS *> foldMany1 (singleton . toChar <$> atext) <* optionalCFWS

word :: (Alternative (f s), CharParsing f s a, SM s) => (f s) s
word = atom <|> quotedString

which would fail for non-ASCII characters. A round trip fails:

parseOnly address $ renderAddress $ Single $ Mailbox (Just "Füh") (AddrSpec "f" (DomainDotAtom $ pure "example.test"))
@romanofski romanofski linked a pull request Jan 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant