pjones / addy

A full-featured library for parsing, validating, and rendering email addresses
BSD 2-Clause "Simplified" License
4 stars 1 forks source link

`decode (encode …)` is not guaranteed to succeed #6

Closed JaSpa closed 3 years ago

JaSpa commented 3 years ago

There are mail addresses which can be decoded successfully, but trying to decode the re-encoded version fails:

decode "a\\\"b@c"
-- Right (EmailAddr "a\"b@c")

encode $ decode "\"a\\\"b\"@c" ^?! _Right
-- "a\"b@c"

decode $ encode $ decode "\"a\\\"b\"@c" ^?! _Right
-- Left (ParserFailedError "local part > quoted content > '\"': Failed reading: satisfy" :| [])

I feel the string returned from encode … should always succeed to decode again.

JaSpa commented 3 years ago

So sorry, this is not correct. I didn't realize I hadn't rolled back all of my local changes at that point!