-
Notifications
You must be signed in to change notification settings - Fork 51
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
Encode::MIME::Header: Rewrite both decoder and encoder #51
Conversation
Encoder should be now fully compliant of RFC 2047. Decoder is less strict to be able to decode strings generated by old versions of this module. To enforce correct strict mode, set package variable $Encode::MIME::Header::STRICT_DECODE to 1.
Encode::MIME::Header: Rewrite both decoder and encoder
Thank you! |
Thanks so much for this, I was just today wondering about trying to fix some of the issues with Encode::MIME::Header and found this had just already been done :) Looking forward to it being released. |
First of all, thanks for the effort. I am the author of Email::MIME::RFC2047 and invested quite some time trying to make it robust and RFC-conformant. I ran some tests from my module against your code and the only problems I found are the handling of invalid encoded words. Examples: Encoded words that aren't separated by whitespace like
and
Then there are encoded words with invalid contents like
This doesn't rule out to completely remove invalid encoded words, but I think it's safer to keep them. Some client code might treat an empty email header as an error condition. |
@nwellnhof: local $Encode::MIME::Header::STRICT_DECODE = 1; |
Great, this works. (Encoded words with invalid contents are still stripped, though.) |
@nwellnhof How should be correctly decoded string "=?iso-8859-1?b?----?=" ? I think RFC 2047 does not specify it. If you have good idea I can fix it in STRICT_DECODE. |
I would simply leave such strings undecoded. |
Ok, that could make sense in STRICT_DECODE. I will prepare some patches for it... |
---------------------------------- Revision: 2.84 Date: 2016/04/11 07:17:02 ! lib/Encode/MIME/Header.pm Pulled: Encode::MIME::Header: Update description that this module is only for unstructured header dankogai/p5-encode#53 ! lib/Encode/MIME/Header.pm t/mime-header.t Pulled: Encode::MIME::Header: Fix valid_q_chars, '-' needs to be escaped dankogai/p5-encode#52 2.83 2016/03/24 07:49:54 ! lib/Encode/MIME/Header.pm t/mime-header.t Both decoder and encoder are rewritten by Pali Rohár. Encoder should be now fully compliant of RFC 2047. Decoder is less strict to be able to decode strings generated by old versions of this module. dankogai/p5-encode#51 ! t/mime-header.t Add more test vectors from RFC2047, pp.11-12 ! lib/Encode/Supported.pod merge: Autrijus -> Audrey dankogai/p5-encode#50 2.82 2016/02/06 20:17:24 ! lib/Encode/MIME/Header.pm lib/Encode/MIME/Header/ISO_2022_JP.pm t/mime-header.t Reverted to 2.80 upon the request of whom submitted pull/48 2.81 2016/02/06 19:25:22 ! lib/Encode/MIME/Header.pm lib/Encode/MIME/Header/ISO_2022_JP.pm t/mime-header.t Merged: Encode::MIME::Header: Fix decoder and rewrite encoder > Encoder should be now fully compliant of RFC 2047. > Decoder is less strict to be able to decode strings > generated by old versions of this module. dankogai/p5-encode#48 ! t/mime-header.t merge t/mime-header.t @ https://github.com/asjo/p5-encode https://github.com/asjo/p5-encode/commit/19dcbff63e71909ffda7c151a73c5baaffe2976c ! t/mime-header.t Add more test vectors from RFC2047, pp.11-12
Implemented in #68 |
Encoder should be now fully compliant of RFC 2047. Decoder is less strict
to be able to decode strings generated by old versions of this module.
To enforce correct strict mode, set package variable
$Encode::MIME::Header::STRICT_DECODE to 1.