On Friday 11 May 2018 18:52:13 Eric Wong wrote:
> Hello, I noticed a behavior change somewhere in the Email::MIME
> stack when header_str_set is passed a string with a single-quote
> (') character in it.

So you mean that input header

    "Quoted N'Ame" <f...@example.com>

is changed to

    "Quoted N\'Ame" <f...@example.com>


> On my Debian stable (stretch) machine the behavior is to
> leave the single quote alone.  On Debian unstable/sid,
> a backslash is added before the single-quote.
> Changes from stretch to current sid are as follows:
> perl (including Encode.pm)      5.24.1-3+deb9u3 -> 5.26.2-3
> libemail-mime-perl              1.937-1 -> 1.946-1
> unchanged:
> libemail-mime-encodings-perl    1.315-1 -> 1.315-2
>       (only Debian-specific packaging changes, I suspect)
> I think the old behavior (not adding backslash) is correct, but
> I'm not sure.


    "Quoted N'Ame" <f...@example.com>

    "Quoted N\'Ame" <f...@example.com>

are syntactically and semantically valid and correct. And represent
exactly same phrase. Just first one is shorter as an apostrophe
character is not needed to escape. (But you can).

Escaping ' character is done by Email::Address::XS module which
Email::MIME uses. So it is not Email::MIME (related) code.

> I can work around the problem with "header_set"
> instead.
>       use strict;
>       use warnings;
>       use Email::MIME;
>       my $mime = Email::MIME->create;
>       my $h = 'From';
>       my $n = q("Quoted N'Ame" <f...@example.com>);
>       $mime->header_str_set($h, $n);
>       print $mime->header($h), "\n"; # adds backslash to '
> Konstantin hit this with public-inbox on CentOS but using newer
> modules from CPAN and older Perl:
> https://public-inbox.org/meta/2a2bf0e1-fd1f-f8bf-95bc-dac47906e...@linuxfoundation.org/

Ok, I will change Email::Address::XS module to not escape ' character
when it is not needed.

I found another similar problems in Email::Address::XS. I will try to
fix them in next Email::Address::XS version. And once it will be fixed
you would just need to update to new Email::Address::XS version. Nothing
to do in Email::MIME.

If you know more similar problems, please let me know.

Thanks for report!

>       # cpanm --info Email::MIME
>       RJBS/Email-MIME-1.946.tar.gz
>       # cpanm --info Email::MIME::Encodings
>       RJBS/Email-MIME-Encodings-1.315.tar.gz
>       # cpanm --info Email::Simple
>       RJBS/Email-Simple-2.214.tar.gz
>       # perl --version
>       This is perl 5, version 16, subversion 3 (v5.16.3) built for
>       x86_64-linux-thread-multi
>       (with 33 registered patches, see perl -V for more detail)

Reply via email to