develooper Front page | perl.pep | Postings from May 2018

behavior change regarding quoted strings

Thread Next
From:
Eric Wong
Date:
May 11, 2018 18:59
Subject:
behavior change regarding quoted strings
Message ID:
20180511185213.GA23717@dcvr
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.

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.  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" <foo@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-dac47906ef43@linuxfoundation.org/

	# 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)

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About