From 12679ab7d3c2a210f4123163671b532b8b55d5f9 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 15 Mar 2024 03:06:35 +0000 Subject: CTAN sync 202403150306 --- .../texlive/tlnet/tlpkg/tlperl/lib/Encode/Alias.pm | 6 ++- .../tlnet/tlpkg/tlperl/lib/Encode/GSM0338.pm | 52 ++++++++++++---------- .../texlive/tlnet/tlpkg/tlperl/lib/Encode/JP.pm | 6 +-- .../tlnet/tlpkg/tlperl/lib/Encode/MIME/Header.pm | 8 +++- .../tlnet/tlpkg/tlperl/lib/Encode/Unicode.pm | 16 +++---- 5 files changed, 50 insertions(+), 38 deletions(-) (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/Encode') diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Alias.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Alias.pm index dbfa01b618..cca72a3d84 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Alias.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Alias.pm @@ -1,7 +1,7 @@ package Encode::Alias; use strict; use warnings; -our $VERSION = do { my @r = ( q$Revision: 2.24 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.25 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; use Exporter 'import'; @@ -162,6 +162,10 @@ sub init_aliases { # Allow variants of iso-8859-1 etc. define_alias( qr/\biso[-_]?(\d+)[-_](\d+)$/i => '"iso-$1-$2"' ); + # ISO-8859-8-I => ISO-8859-8 + # https://en.wikipedia.org/wiki/ISO-8859-8-I + define_alias( qr/\biso[-_]8859[-_]8[-_]I$/i => '"iso-8859-8"' ); + # At least HP-UX has these. define_alias( qr/\biso8859(\d+)$/i => '"iso-8859-$1"' ); diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/GSM0338.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/GSM0338.pm index 644d445285..b149c6dc9c 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/GSM0338.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/GSM0338.pm @@ -1,5 +1,5 @@ # -# $Id: GSM0338.pm,v 2.9 2020/12/02 01:28:17 dankogai Exp dankogai $ +# $Id: GSM0338.pm,v 2.10 2021/05/24 10:56:53 dankogai Exp $ # package Encode::GSM0338; @@ -8,7 +8,7 @@ use warnings; use Carp; use vars qw($VERSION); -$VERSION = do { my @r = ( q$Revision: 2.9 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +$VERSION = do { my @r = ( q$Revision: 2.10 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(:fallbacks); @@ -159,12 +159,12 @@ our %UNI2GSM = ( "\x{20AC}" => "\x1B\x65", # EURO SIGN ); our %GSM2UNI = reverse %UNI2GSM; -our $ESC = "\x1b"; +our $ESC = "\x1b"; sub decode ($$;$) { my ( $obj, $bytes, $chk ) = @_; return undef unless defined $bytes; - my $str = substr($bytes, 0, 0); # to propagate taintedness; + my $str = substr( $bytes, 0, 0 ); # to propagate taintedness; while ( length $bytes ) { my $seq = ''; my $c; @@ -173,53 +173,57 @@ sub decode ($$;$) { $seq .= $c; } while ( length $bytes and $c eq $ESC ); my $u = - exists $GSM2UNI{$seq} - ? $GSM2UNI{$seq} - : ($chk && ref $chk eq 'CODE') - ? $chk->( unpack 'C*', $seq ) - : "\x{FFFD}"; + exists $GSM2UNI{$seq} ? $GSM2UNI{$seq} + : ( $chk && ref $chk eq 'CODE' ) ? $chk->( unpack 'C*', $seq ) + : "\x{FFFD}"; if ( not exists $GSM2UNI{$seq} and $chk and not ref $chk ) { - if ( substr($seq, 0, 1) eq $ESC and ($chk & Encode::STOP_AT_PARTIAL) ) { + if ( substr( $seq, 0, 1 ) eq $ESC + and ( $chk & Encode::STOP_AT_PARTIAL ) ) + { $bytes .= $seq; last; } - croak join( '', map { sprintf "\\x%02X", $_ } unpack 'C*', $seq ) . ' does not map to Unicode' if $chk & Encode::DIE_ON_ERR; - carp join( '', map { sprintf "\\x%02X", $_ } unpack 'C*', $seq ) . ' does not map to Unicode' if $chk & Encode::WARN_ON_ERR; - if ($chk & Encode::RETURN_ON_ERR) { + croak join( '', map { sprintf "\\x%02X", $_ } unpack 'C*', $seq ) + . ' does not map to Unicode' + if $chk & Encode::DIE_ON_ERR; + carp join( '', map { sprintf "\\x%02X", $_ } unpack 'C*', $seq ) + . ' does not map to Unicode' + if $chk & Encode::WARN_ON_ERR; + if ( $chk & Encode::RETURN_ON_ERR ) { $bytes .= $seq; last; } } $str .= $u; } - $_[1] = $bytes if not ref $chk and $chk and !($chk & Encode::LEAVE_SRC); + $_[1] = $bytes if not ref $chk and $chk and !( $chk & Encode::LEAVE_SRC ); return $str; } sub encode($$;$) { my ( $obj, $str, $chk ) = @_; return undef unless defined $str; - my $bytes = substr($str, 0, 0); # to propagate taintedness + my $bytes = substr( $str, 0, 0 ); # to propagate taintedness while ( length $str ) { my $u = substr( $str, 0, 1, '' ); my $c; my $seq = - exists $UNI2GSM{$u} - ? $UNI2GSM{$u} - : ($chk && ref $chk eq 'CODE') - ? $chk->( ord($u) ) - : $UNI2GSM{'?'}; + exists $UNI2GSM{$u} ? $UNI2GSM{$u} + : ( $chk && ref $chk eq 'CODE' ) ? $chk->( ord($u) ) + : $UNI2GSM{'?'}; if ( not exists $UNI2GSM{$u} and $chk and not ref $chk ) { - croak sprintf( "\\x{%04x} does not map to %s", ord($u), $obj->name ) if $chk & Encode::DIE_ON_ERR; - carp sprintf( "\\x{%04x} does not map to %s", ord($u), $obj->name ) if $chk & Encode::WARN_ON_ERR; - if ($chk & Encode::RETURN_ON_ERR) { + croak sprintf( "\\x{%04x} does not map to %s", ord($u), $obj->name ) + if $chk & Encode::DIE_ON_ERR; + carp sprintf( "\\x{%04x} does not map to %s", ord($u), $obj->name ) + if $chk & Encode::WARN_ON_ERR; + if ( $chk & Encode::RETURN_ON_ERR ) { $str .= $u; last; } } $bytes .= $seq; } - $_[1] = $str if not ref $chk and $chk and !($chk & Encode::LEAVE_SRC); + $_[1] = $str if not ref $chk and $chk and !( $chk & Encode::LEAVE_SRC ); return $bytes; } diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/JP.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/JP.pm index 4251170c56..09efaaa8c3 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/JP.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/JP.pm @@ -7,7 +7,7 @@ BEGIN { use strict; use warnings; use Encode; -our $VERSION = do { my @r = ( q$Revision: 2.4 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.5 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); @@ -50,8 +50,8 @@ supported are as follows. cp932 /\bwindows-31j$/i Code Page 932 = Shift JIS + MS/IBM vendor mappings jis0201-raw JIS0201, raw format - jis0208-raw JIS0201, raw format - jis0212-raw JIS0201, raw format + jis0208-raw JIS0208, raw format + jis0212-raw JIS0212, raw format -------------------------------------------------------------------- =head1 DESCRIPTION diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/MIME/Header.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/MIME/Header.pm index 848de99fa4..4d4574447e 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/MIME/Header.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/MIME/Header.pm @@ -2,7 +2,7 @@ package Encode::MIME::Header; use strict; use warnings; -our $VERSION = do { my @r = ( q$Revision: 2.28 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.29 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Carp (); use Encode (); @@ -55,7 +55,7 @@ my $re_capture_encoded_word_split = qr/=\?($re_charset)((?:\*$re_language)?)\?($ # in strict mode check also for valid base64 characters and also for valid quoted printable codes my $re_encoding_strict_b = qr/[Bb]/; my $re_encoding_strict_q = qr/[Qq]/; -my $re_encoded_text_strict_b = qr/[0-9A-Za-z\+\/]*={0,2}/; +my $re_encoded_text_strict_b = qr/(?:[0-9A-Za-z\+\/]{4})*(?:[0-9A-Za-z\+\/]{2}==|[0-9A-Za-z\+\/]{3}=|)/; my $re_encoded_text_strict_q = qr/(?:[\x21-\x3C\x3E\x40-\x7E]|=[0-9A-Fa-f]{2})*/; # NOTE: first part are printable US-ASCII except ?, =, SPACE and TAB my $re_encoded_word_strict = qr/=\?$re_charset(?:\*$re_language)?\?(?:$re_encoding_strict_b\?$re_encoded_text_strict_b|$re_encoding_strict_q\?$re_encoded_text_strict_q)\?=/; my $re_capture_encoded_word_strict = qr/=\?($re_charset)((?:\*$re_language)?)\?($re_encoding_strict_b\?$re_encoded_text_strict_b|$re_encoding_strict_q\?$re_encoded_text_strict_q)\?=/; @@ -94,6 +94,10 @@ sub decode($$;$) { $stop = 1 unless length($line) or length($sep); + # in non strict mode append missing '=' padding characters for b words + # fixes below concatenation of consecutive encoded mime words + 1 while not $STRICT_DECODE and $line =~ s/(=\?$re_charset(?:\*$re_language)?\?[Bb]\?)((?:[^\?]{4})*[^\?]{1,3})(\?=)/$1.$2.('='x(4-length($2)%4)).$3/se; + # NOTE: this code partially could break $chk support # in non strict mode concat consecutive encoded mime words with same charset, language and encoding # fixes breaking inside multi-byte characters diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Unicode.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Unicode.pm index 540337e94f..965803772f 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Unicode.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Encode/Unicode.pm @@ -3,7 +3,7 @@ package Encode::Unicode; use strict; use warnings; -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.20 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); @@ -170,7 +170,7 @@ simply treated as a normal character (ZERO WIDTH NO-BREAK SPACE). When BE or LE is omitted during decode(), it checks if BOM is at the beginning of the string; if one is found, the endianness is set to -what the BOM says. +what the BOM says. =item * @@ -258,15 +258,15 @@ Consider that "division by zero" of Encode :) =head1 SEE ALSO -L, L, L, -L, +L, L, L, +L, RFC 2781 L, -The whole Unicode standard L +The whole Unicode standard L -Ch. 15, pp. 403 of C -by Larry Wall, Tom Christiansen, Jon Orwant; -O'Reilly & Associates; ISBN 0-596-00027-8 +Ch. 6 pp. 275 of C +by Tom Christiansen, brian d foy & Larry Wall; +O'Reilly & Associates; ISBN 978-0-596-00492-7 =cut -- cgit v1.2.3