Enough-Software / enough_mail

IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.
Mozilla Public License 2.0
104 stars 55 forks source link

Quoted-Printable vs. Q-Encoding #77

Closed hpoul closed 4 years ago

hpoul commented 4 years ago

Hi, I think there is some confusion in the QuotedPrintableMailCodec - It references RFC 2045 Quoted-Printable, but at least partially implements RFC 2047 "Q" Encoding.

At least the problem i've stumbled upon was:

https://github.com/Enough-Software/enough_mail/blob/1f95f82c5ee0867c7f52d596bea09e2a5ab1407f/lib/codecs/quoted_printable_mail_codec.dart#L123-L125

Underscores should not be decoded to a SPACE according to 2045, as far as I understand it.

Any thoughts? Is this supposed to decode Quoted-Printable or Q-Encoding?

hpoul commented 4 years ago

Unfortunately I'm not really 100% fluent in RFCs :-) but how about simply introducing a 'header' flag which would switch between Quoted-Printabe (header=false) vs. "Q" Encoding (header=true) - this is how python seems to implement it:

https://github.com/python/cpython/blob/46e448abbf35c051e5306a4695670d7ec7abc4e9/Lib/quopri.py#L141-L144

robert-virkus commented 4 years ago

Thanks Herbert, let me check out the RFCs and then work on the fixes. Possibly it's cleaner to provide a separate codec implementation for both sub encoding types.

robert-virkus commented 4 years ago

This should be fixed in release v0.0.32 now

hpoul commented 4 years ago

@robert-virkus looks good, thanks!