diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-01-27 08:28:33 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-01-28 08:13:27 +0000 |
commit | 8693e0c5075cb105c408887836410d3f5a02ae0b (patch) | |
tree | 22b0f84be7af1d2c915ded5dca89c1c5d93e7689 /cpan/Encode | |
parent | 408b5f5e5c834e50f3f4c338bc06eba756e660ff (diff) | |
download | perl-8693e0c5075cb105c408887836410d3f5a02ae0b.tar.gz |
Upgrade Encode from version 2.79 to 2.80
Diffstat (limited to 'cpan/Encode')
-rw-r--r-- | cpan/Encode/Encode.pm | 4 | ||||
-rw-r--r-- | cpan/Encode/lib/Encode/MIME/Header.pm | 19 | ||||
-rw-r--r-- | cpan/Encode/t/mime-header.t | 22 |
3 files changed, 21 insertions, 24 deletions
diff --git a/cpan/Encode/Encode.pm b/cpan/Encode/Encode.pm index a09a20c91f..3dade96bf3 100644 --- a/cpan/Encode/Encode.pm +++ b/cpan/Encode/Encode.pm @@ -1,10 +1,10 @@ # -# $Id: Encode.pm,v 2.79 2016/01/22 06:32:20 dankogai Exp $ +# $Id: Encode.pm,v 2.80 2016/01/25 14:54:01 dankogai Exp $ # package Encode; use strict; use warnings; -our $VERSION = sprintf "%d.%02d", q$Revision: 2.79 $ =~ /(\d+)/g; +our $VERSION = sprintf "%d.%02d", q$Revision: 2.80 $ =~ /(\d+)/g; use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; use XSLoader (); XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/cpan/Encode/lib/Encode/MIME/Header.pm b/cpan/Encode/lib/Encode/MIME/Header.pm index 8b2dbb5628..ba6adba475 100644 --- a/cpan/Encode/lib/Encode/MIME/Header.pm +++ b/cpan/Encode/lib/Encode/MIME/Header.pm @@ -3,7 +3,7 @@ use strict; use warnings; no warnings 'redefine'; -our $VERSION = do { my @r = ( q$Revision: 2.18 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.19 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(find_encoding encode_utf8 decode_utf8); use MIME::Base64; use Carp; @@ -39,7 +39,9 @@ sub perlio_ok { 0 } sub decode($$;$) { use utf8; my ( $obj, $str, $chk ) = @_; - + # zap spaces between encoded words + $str =~ s/\?=\s+=\?/\?==\?/gos; + # multi-line header to single line $str =~ s/(?:\r\n|[\r\n])[ \t]//gos; @@ -115,15 +117,10 @@ sub encode($$;$) { my @line = (); for my $line ( split /\r\n|[\r\n]/o, $str ) { my ( @word, @subline ); - for my $word ( split /($re_linear_white_space+)/o, $line ) { - if ( $word =~ /[^\x00-\x7f]/o - or $word =~ /^$re_encoded_word$/o ) - { - push @word, $obj->_encode($word); - } - else { - push @word, $word; - } + if ($line =~ /\A([\w\-]+:\s+)(.*)\z/o) { + push @word, $1, $obj->_encode($2); # "X-Header-Name: ..." + } else { + push @word, $obj->_encode($line); # anything else } my $subline = ''; for my $word (@word) { diff --git a/cpan/Encode/t/mime-header.t b/cpan/Encode/t/mime-header.t index 8dfd708e6a..b031aa4010 100644 --- a/cpan/Encode/t/mime-header.t +++ b/cpan/Encode/t/mime-header.t @@ -1,5 +1,5 @@ # -# $Id: mime-header.t,v 2.7 2016/01/22 06:33:07 dankogai Exp $ +# $Id: mime-header.t,v 2.8 2016/01/25 14:54:13 dankogai Exp dankogai $ # This script is written in utf8 # BEGIN { @@ -73,9 +73,8 @@ Subject: 漢字、カタカナ、ひらがなを含む、非常に長いタイ EOS my $bheader =<<'EOS'; -From: =?UTF-8?B?5bCP6aO8?= =?UTF-8?B?5by+?= <dankogai@dan.co.jp> -To: dankogai@dan.co.jp =?UTF-8?B?KOWwj+mjvD1Lb2dhaSw=?= - =?UTF-8?B?5by+PURhbik=?= +From: =?UTF-8?B?5bCP6aO8IOW8viA8ZGFua29nYWlAZGFuLmNvLmpwPg==?= +To: =?UTF-8?B?ZGFua29nYWlAZGFuLmNvLmpwICjlsI/po7w9S29nYWksIOW8vj1EYW4p?= Subject: =?UTF-8?B?5ryi5a2X44CB44Kr44K/44Kr44OK44CB44Gy44KJ44GM44Gq44KS5ZCr44KA?= =?UTF-8?B?44CB6Z2e5bi444Gr6ZW344GE44K/44Kk44OI44Or6KGM44GM5LiA5L2T5YWo?= @@ -84,10 +83,10 @@ Subject: EOS my $qheader=<<'EOS'; -From: =?UTF-8?Q?=E5=B0=8F=E9=A3=BC?= =?UTF-8?Q?=E5=BC=BE?= - <dankogai@dan.co.jp> -To: dankogai@dan.co.jp =?UTF-8?Q?=28=E5=B0=8F=E9=A3=BC=3DKogai=2C?= - =?UTF-8?Q?=E5=BC=BE=3DDan=29?= +From: =?UTF-8?Q?=E5=B0=8F=E9=A3=BC=20=E5=BC=BE=20=3Cdankogai=40?= + =?UTF-8?Q?dan=2Eco=2Ejp=3E?= +To: =?UTF-8?Q?dankogai=40dan=2Eco=2Ejp=20=28?= + =?UTF-8?Q?=E5=B0=8F=E9=A3=BC=3DKogai=2C=20=E5=BC=BE=3DDan?= =?UTF-8?Q?=29?= Subject: =?UTF-8?Q?=E6=BC=A2=E5=AD=97=E3=80=81=E3=82=AB=E3=82=BF=E3=82=AB=E3=83=8A?= =?UTF-8?Q?=E3=80=81=E3=81=B2=E3=82=89=E3=81=8C=E3=81=AA=E3=82=92=E5=90=AB?= @@ -104,8 +103,9 @@ is(Encode::encode('MIME-B', $dheader)."\n", $bheader, "encode B"); is(Encode::encode('MIME-Q', $dheader)."\n", $qheader, "encode Q"); $dheader = "What is =?UTF-8?B?w4RwZmVs?= ?"; -$bheader = "What is =?UTF-8?B?PT9VVEYtOD9CP3c0UndabVZzPz0=?= ?"; -$qheader = "What is =?UTF-8?Q?=3D=3FUTF=2D8=3FB=3Fw4RwZmVs=3F=3D?= ?"; +$bheader = "=?UTF-8?B?V2hhdCBpcyA9P1VURi04P0I/dzRSd1ptVnM/PSA/?="; +$qheader = "=?UTF-8?Q?What=20is=20=3D=3FUTF=2D8=3FB=3Fw4R?=" + . "\n " . "=?UTF-8?Q?wZmVs=3F=3D=20=3F?="; is(Encode::encode('MIME-B', $dheader), $bheader, "Double decode B"); is(Encode::encode('MIME-Q', $dheader), $qheader, "Double decode Q"); { @@ -128,5 +128,5 @@ is(Encode::encode('MIME-Q', $rt42627), 'MIME-Q encoding does not truncate trailing zeros'); # RT87831 -is(Encode::encode('MIME-Header', '0'), '0', 'RT87831'); +is(Encode::encode('MIME-Header', '0'), '=?UTF-8?B?MA==?=', 'RT87831'); __END__; |