This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cpan/Encode: sync with CPAN version 3.08
authorDan Kogai <dankogai@dan.co.jp>
Wed, 2 Dec 2020 22:13:45 +0000 (17:13 -0500)
committerJames E Keenan <jkeenan@cpan.org>
Wed, 2 Dec 2020 22:15:55 +0000 (17:15 -0500)
Porting/Maintainers.pl
cpan/Encode/Encode.pm
cpan/Encode/Makefile.PL
cpan/Encode/bin/encguess
cpan/Encode/lib/Encode/GSM0338.pm
cpan/Encode/t/gsm0338.t

index dcf1e73..269e919 100755 (executable)
@@ -383,7 +383,7 @@ use File::Glob qw(:case);
     },
 
     'Encode' => {
     },
 
     'Encode' => {
-        'DISTRIBUTION' => 'DANKOGAI/Encode-3.07.tar.gz',
+        'DISTRIBUTION' => 'DANKOGAI/Encode-3.08.tar.gz',
         'FILES'        => q[cpan/Encode],
         'EXCLUDED'     => [
             qw( t/whatwg-aliases.json
         'FILES'        => q[cpan/Encode],
         'EXCLUDED'     => [
             qw( t/whatwg-aliases.json
index 77ca93e..d3eb3c1 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# $Id: Encode.pm,v 3.07 2020/07/25 12:59:10 dankogai Exp $
+# $Id: Encode.pm,v 3.08 2020/12/02 01:27:44 dankogai Exp $
 #
 package Encode;
 use strict;
 #
 package Encode;
 use strict;
@@ -7,7 +7,7 @@ use warnings;
 use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG};
 our $VERSION;
 BEGIN {
 use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG};
 our $VERSION;
 BEGIN {
-    $VERSION = sprintf "%d.%02d", q$Revision: 3.07 $ =~ /(\d+)/g;
+    $VERSION = sprintf "%d.%02d", q$Revision: 3.08 $ =~ /(\d+)/g;
     require XSLoader;
     XSLoader::load( __PACKAGE__, $VERSION );
 }
     require XSLoader;
     XSLoader::load( __PACKAGE__, $VERSION );
 }
index 8c20d20..f9c7748 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# $Id: Makefile.PL,v 2.22 2017/10/06 22:21:53 dankogai Exp $
+# $Id: Makefile.PL,v 2.23 2020/12/02 01:28:17 dankogai Exp dankogai $
 #
 use 5.007003;
 use strict;
 #
 use 5.007003;
 use strict;
@@ -70,7 +70,7 @@ WriteMakefile(
         Storable   => '0',      # bundled with Perl 5.7.3
     },
     TEST_REQUIRES => {
         Storable   => '0',      # bundled with Perl 5.7.3
     },
     TEST_REQUIRES => {
-        'Test::More' => '0.81_01',
+        'Test::More' => '0.92',
     },
     PMLIBDIRS   => \@pmlibdirs,
     INSTALLDIRS => ($] < 5.011 ? 'perl' : 'site'),
     },
     PMLIBDIRS   => \@pmlibdirs,
     INSTALLDIRS => ($] < 5.011 ? 'perl' : 'site'),
index 0f344ea..19a0673 100644 (file)
@@ -61,7 +61,7 @@ encguess - guess character encodings of files
 
 =head1 VERSION
 
 
 =head1 VERSION
 
-$Id: encguess,v 0.2 2016/08/04 03:15:58 dankogai Exp $
+$Id: encguess,v 0.3 2020/12/02 01:28:17 dankogai Exp dankogai $
 
 =head1 SYNOPSIS
 
 
 =head1 SYNOPSIS
 
@@ -78,7 +78,7 @@ show this message and exit.
 =item -s
 
 specify a list of "suspect encoding types" to test, 
 =item -s
 
 specify a list of "suspect encoding types" to test, 
-seperated by either C<:> or C<,>
+separated by either C<:> or C<,>
 
 =item -S
 
 
 =item -S
 
index 8b23a7b..644d445 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# $Id: GSM0338.pm,v 2.8 2020/07/25 12:59:29 dankogai Exp dankogai $
+# $Id: GSM0338.pm,v 2.9 2020/12/02 01:28:17 dankogai Exp dankogai $
 #
 package Encode::GSM0338;
 
 #
 package Encode::GSM0338;
 
@@ -8,16 +8,13 @@ use warnings;
 use Carp;
 
 use vars qw($VERSION);
 use Carp;
 
 use vars qw($VERSION);
-$VERSION = do { my @r = ( q$Revision: 2.8 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
+$VERSION = do { my @r = ( q$Revision: 2.9 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
 
 use Encode qw(:fallbacks);
 
 use parent qw(Encode::Encoding);
 __PACKAGE__->Define('gsm0338');
 
 
 use Encode qw(:fallbacks);
 
 use parent qw(Encode::Encoding);
 __PACKAGE__->Define('gsm0338');
 
-sub needs_lines { 1 }
-sub perlio_ok   { 0 }
-
 use utf8;
 
 # Mapping table according to 3GPP TS 23.038 version 16.0.0 Release 16 and ETSI TS 123 038 V16.0.0 (2020-07)
 use utf8;
 
 # Mapping table according to 3GPP TS 23.038 version 16.0.0 Release 16 and ETSI TS 123 038 V16.0.0 (2020-07)
@@ -182,6 +179,10 @@ sub decode ($$;$) {
             ? $chk->( unpack 'C*', $seq )
             : "\x{FFFD}";
         if ( not exists $GSM2UNI{$seq} and $chk and not ref $chk ) {
             ? $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) ) {
+                $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) {
index 21a82fa..ab98583 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
 
 use strict;
 use utf8;
 
 use strict;
 use utf8;
-use Test::More tests => 776;
+use Test::More tests => 777;
 use Encode;
 use Encode::GSM0338;
 
 use Encode;
 use Encode::GSM0338;
 
@@ -83,49 +83,9 @@ is encode("gsm0338", chr(0xC7)) => "\x09", 'RT75670: encode';
 is decode("gsm0338", encode('gsm0338', '..@@..')), '..@@..';
 is decode("gsm0338", encode('gsm0338', '..@€..')), '..@€..';
 
 is decode("gsm0338", encode('gsm0338', '..@@..')), '..@@..';
 is decode("gsm0338", encode('gsm0338', '..@€..')), '..@€..';
 
-__END__
-for my $c (map { chr } 0..127){
-    my $b = "\x1b$c";
-    my $u =  $Encode::GSM0338::GSM2UNI{$b};
-    next unless $u;
-    $u ||= "\xA0" . $Encode::GSM0338::GSM2UNI{$c};
-    is decode("gsm0338", $b), $u, sprintf("decode ESC+\\x%02X", ord($c) );
-}
-
-__END__
-# old test follows
-ub t { is(decode("gsm0338", my $t = $_[0]), $_[1]) }
-
-# t("\x00",     "\x00"); # ???
-
-# "Round-trip".
-t("\x41",     "\x41");
-
-t("\x01",     "\xA3");
-t("\x02",     "\x24");
-t("\x03",     "\xA5");
-t("\x09",     "\xE7");
-
-t("\x00\x00", "\x00\x00"); # Maybe?
-t("\x00\x1B", "\x40\xA0"); # Maybe?
-t("\x00\x41", "\x40\x41");
-
-# t("\x1B",     "\x1B"); # ???
-
-# Escape with no special second byte is just a NBSP.
-t("\x1B\x41", "\xA0\x41");
-
-t("\x1B\x00", "\xA0\x40"); # Maybe?
-
-# Special escape characters.
-t("\x1B\x0A", "\x0C");
-t("\x1B\x14", "\x5E");
-t("\x1B\x28", "\x7B");
-t("\x1B\x29", "\x7D");
-t("\x1B\x2F", "\x5C");
-t("\x1B\x3C", "\x5B");
-t("\x1B\x3D", "\x7E");
-t("\x1B\x3E", "\x5D");
-t("\x1B\x40", "\x7C");
-t("\x1B\x40", "\x7C");
-t("\x1B\x65", "\x{20AC}");
+# special GSM sequence, € is at 1024 byte buffer boundary
+my $gsm = "\x41" . "\x1B\x65" x 1024;
+open my $fh, '<:encoding(gsm0338)', \$gsm or die;
+my $uni = <$fh>;
+close $fh;
+is $uni, "A" . "€" x 1024, 'PerlIO encoding(gsm0338) read works';