Upgrade to Encode 2.19
authorNicholas Clark <nick@ccl4.org>
Sat, 7 Apr 2007 12:45:44 +0000 (12:45 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 7 Apr 2007 12:45:44 +0000 (12:45 +0000)
p4raw-id: //depot/perl@30866

14 files changed:
ext/Encode/AUTHORS
ext/Encode/Changes
ext/Encode/Encode.pm
ext/Encode/Encode.xs
ext/Encode/bin/piconv
ext/Encode/encoding.pm
ext/Encode/lib/Encode/Alias.pm
ext/Encode/lib/Encode/CJKConstants.pm
ext/Encode/lib/Encode/JP/H2Z.pm
ext/Encode/lib/Encode/JP/JIS7.pm
ext/Encode/lib/Encode/MIME/Header.pm
ext/Encode/lib/Encode/Unicode/UTF7.pm
ext/Encode/t/Aliases.t
ext/Encode/t/mime-header.t

index 60a7da0..647b356 100644 (file)
@@ -50,6 +50,7 @@ SADAHIRO Tomoyuki             <SADAHIRO@cpan.org>
 SUGAWARA Hajime                        <sugawara@hdt.co.jp>
 SUZUKI Norio                   <ZAP00217@nifty.com>
 Simon Cozens                   <simon@netthink.co.uk>
+Slaven Rezic                   <SREZIC@cpan.org>
 Spider Boardman                        <spider@web.zk3.dec.com>
 Steve Hay                      <steve.hay@uk.radan.com>
 Steve Peters                   <steve@fisharerojo.org>
index e7b2d7a..5039a73 100644 (file)
@@ -1,8 +1,33 @@
 # Revision history for Perl extension Encode.
 #
-# $Id: Changes,v 2.17 2006/06/03 20:28:48 dankogai Exp dankogai $
+# $Id: Changes,v 2.19 2007/04/06 12:53:41 dankogai Exp dankogai $
 #
-$Revision: 2.17 $ $Date: 2006/06/03 20:28:48 $
+$Revision: 2.19 $ $Date: 2007/04/06 12:53:41 $
+! lib/Encode/JP/JIS7.pm
++ t/jis7-fallback.t
+  encode('iso-2022-jp') fallback support added by MIYAGAWA++
+  decode()'s fallback remains unchanged (FB_PERLQQ) since UTF-8
+  contains all characters in iso-2022-jp so there's no need for fancy stuff.
+  Message-Id: <693254b90704060526s6d850320h71cdda50dfbf7eba@mail.gmail.com>
+! Encode.pm
+  #25216 ([PATCH] Encode.pm: postpone the load of Encode::Encoding)
+  http://rt.cpan.org/NoAuth/Bug.html?id=#25216
+! lib/Encode/MIME/Header.pm t/mime-header.t
+  #24418 (Encode::MIME::Header: wrong encoding with latin1 characters)
+  http://rt.cpan.org/NoAuth/Bug.html?id=#24418
+! Encode.pm
+  #23876 (Add documentation for LEAVE_SRC)
+  http://rt.cpan.org/NoAuth/Bug.html?id=#23876
+! lib/Encode/Alias.pm t/Aliases.t
+  #20781: Thai encoding needs alias for tis-620
+  http://rt.cpan.org/NoAuth/Bug.html?id=#20781
+! bin/piconv AUTHORS
+  #20344: piconv: wrong conversion of utf-16le encoded files (with PATCH)
+  http://rt.cpan.org/NoAuth/Bug.html?id=#20344
+! Encode.pm Encode.xs bin/enc2xs encoding.pm t/Aliases.t t/utf8strict.t
+  Imported from bleedperl's 2.18_01
+
+2.18 2006/06/03 20:28:48
 ! bin/enc2xs
   overhauled the -C option
   - added ascii-ctrl', 'null', 'utf-8-strict' to core
index bdfa695..8b0f4a6 100644 (file)
@@ -1,10 +1,10 @@
 #
-# $Id: Encode.pm,v 2.18 2006/06/03 20:28:48 dankogai Exp dankogai $
+# $Id: Encode.pm,v 2.19 2007/04/06 12:53:41 dankogai Exp dankogai $
 #
 package Encode;
 use strict;
 use warnings;
-our $VERSION = "2.18_01";
+our $VERSION = sprintf "%d.%02d", q$Revision: 2.19 $ =~ /(\d+)/g;
 sub DEBUG () { 0 }
 use XSLoader ();
 XSLoader::load( __PACKAGE__, $VERSION );
@@ -210,7 +210,7 @@ predefine_encodings(1);
 #
 
 sub predefine_encodings {
-    use Encode::Encoding;
+    require Encode::Encoding;
     no warnings 'redefine';
     my $use_xs = shift;
     if ($ON_EBCDIC) {
@@ -659,6 +659,12 @@ constants via C<use Encode qw(:fallback_all)>.
 
 =back
 
+=item Encode::LEAVE_SRC
+
+If the C<Encode::LEAVE_SRC> bit is not set, but I<CHECK> is, then the second
+argument to C<encode()> or C<decode()> may be assigned to by the functions. If
+you're not interested in this, then bitwise-or the bitmask with it.
+
 =head2 coderef for CHECK
 
 As of Encode 2.12 CHECK can also be a code reference which takes the
index ba2bf62..30ede3f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- $Id: Encode.xs,v 2.10 2006/06/03 20:28:48 dankogai Exp dankogai $
+ $Id: Encode.xs,v 2.11 2007/04/06 12:53:41 dankogai Exp dankogai $
  */
 
 #define PERL_NO_GET_CONTEXT
index 0a2f6f9..37dd153 100644 (file)
@@ -1,5 +1,5 @@
 #!./perl
-# $Id: piconv,v 2.2 2006/05/03 18:24:10 dankogai Exp $
+# $Id: piconv,v 2.3 2007/04/06 12:53:41 dankogai Exp dankogai $
 #
 use 5.8.0;
 use strict;
@@ -40,7 +40,7 @@ $Opt{from} || $Opt{to} || help();
 my $from = $Opt{from} || $locale or help("from_encoding unspecified");
 my $to   = $Opt{to}   || $locale or help("to_encoding unspecified");
 $Opt{string} and Encode::from_to($Opt{string}, $from, $to) and print $Opt{string} and exit;
-my $scheme = exists $Scheme{$Opt{Scheme}} ? $Opt{Scheme} :  'from_to';
+my $scheme = exists $Scheme{$Opt{scheme}} ? $Opt{scheme} :  'from_to';
 $Opt{check} ||= $Opt{c};
 $Opt{perlqq}   and $Opt{check} = Encode::PERLQQ;
 $Opt{htmlcref} and $Opt{check} = Encode::HTMLCREF;
@@ -246,6 +246,9 @@ implementation.
 
 The new perlIO layer is used.  NI-S' favorite.
 
+You should use this option if you are using UTF-16 and others which
+linefeed is not $/.
+
 =back
 
 Like the I<-D> option, this is also for Encode hackers.
index 1f418e3..fff7adb 100644 (file)
@@ -1,6 +1,6 @@
-# $Id: encoding.pm,v 2.4 2006/06/03 20:28:48 dankogai Exp dankogai $
+# $Id: encoding.pm,v 2.5 2007/04/06 12:53:41 dankogai Exp dankogai $
 package encoding;
-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 Encode;
 use strict;
@@ -315,6 +315,14 @@ always the same as the length of C<$/> in the native encoding.
 
 This pragma affects utf8::upgrade, but not utf8::downgrade.
 
+=head2 Side effects
+
+If the C<encoding> pragma is in scope then the lengths returned are
+calculated from the length of C<$/> in Unicode characters, which is not
+always the same as the length of C<$/> in the native encoding.
+
+This pragma affects utf8::upgrade, but not utf8::downgrade.
+
 =head1 FEATURES THAT REQUIRE 5.8.1
 
 Some of the features offered by this pragma requires perl 5.8.1.  Most
index 858f60c..b865f0d 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 no warnings 'redefine';
 use Encode;
-our $VERSION = do { my @r = ( q$Revision: 2.6 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
+our $VERSION = do { my @r = ( q$Revision: 2.7 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
 sub DEBUG () { 0 }
 
 use base qw(Exporter);
@@ -189,8 +189,9 @@ sub init_aliases {
         'greek'    => 'iso-8859-7',
         'hebrew'   => 'iso-8859-8',
         'thai'     => 'iso-8859-11',
-        'tis620'   => 'iso-8859-11',
     );
+    # RT #20781
+    define_alias(qr/\btis-?620\b/i  => '"iso-8859-11"');
 
     # At least AIX has IBM-NNN (surprisingly...) instead of cpNNN.
     # And Microsoft has their own naming (again, surprisingly).
index ccc5231..43d2033 100644 (file)
@@ -1,12 +1,12 @@
 #
-# $Id: CJKConstants.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $
+# $Id: CJKConstants.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp $
 #
 
 package Encode::CJKConstants;
 
 use strict;
 use warnings;
-our $RCSID = q$Id: CJKConstants.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $;
+our $RCSID = q$Id: CJKConstants.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp $;
 our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
 
 use Carp;
index 81ce9ac..f8e2230 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: H2Z.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $
+# $Id: H2Z.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp $
 #
 
 package Encode::JP::H2Z;
@@ -7,7 +7,7 @@ package Encode::JP::H2Z;
 use strict;
 use warnings;
 
-our $RCSID = q$Id: H2Z.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp dankogai $;
+our $RCSID = q$Id: H2Z.pm,v 2.2 2006/06/03 20:28:48 dankogai Exp $;
 our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
 
 use Encode::CJKConstants qw(:all);
index f2e0eca..bb048fd 100644 (file)
@@ -1,7 +1,7 @@
 package Encode::JP::JIS7;
 use strict;
 use warnings;
-our $VERSION = do { my @r = ( q$Revision: 2.2 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
+our $VERSION = do { my @r = ( q$Revision: 2.3 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };
 
 use Encode qw(:fallbacks);
 
@@ -49,7 +49,7 @@ sub encode($$;$) {
     # empty the input string in the stack so perlio is ok
     $_[1] = '' if $chk;
     my ( $h2z, $jis0212 ) = @$obj{qw(h2z jis0212)};
-    my $octet = Encode::encode( 'euc-jp', $utf8, FB_PERLQQ );
+    my $octet = Encode::encode( 'euc-jp', $utf8, $chk );
     $h2z and &Encode::JP::H2Z::h2z( \$octet );
     euc_jis( \$octet, $jis0212 );
     return $octet;
index 7e8264a..b664d88 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 no warnings 'redefine';
 
-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 Encode qw(find_encoding encode_utf8 decode_utf8);
 use MIME::Base64;
 use Carp;
@@ -174,12 +174,13 @@ sub _encode_b {
 
 sub _encode_q {
     my $chunk = shift;
+    $chunk = encode_utf8($chunk);
     $chunk =~ s{
         ([^0-9A-Za-z])
            }{
            join("" => map {sprintf "=%02X", $_} unpack("C*", $1))
            }egox;
-    return decode_utf8( HEAD . 'Q?' . $chunk . TAIL );
+    return HEAD . 'Q?' . $chunk . TAIL;
 }
 
 1;
index f8cb169..6ee4619 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: UTF7.pm,v 2.4 2006/06/03 20:28:48 dankogai Exp dankogai $
+# $Id: UTF7.pm,v 2.4 2006/06/03 20:28:48 dankogai Exp $
 #
 package Encode::Unicode::UTF7;
 use strict;
index 9c70944..6fd0fe2 100644 (file)
@@ -42,6 +42,7 @@ sub init_a2c{
         'hebrew'   => 'iso-8859-8',
         'thai'     => 'iso-8859-11',
         'tis620'   => 'iso-8859-11',
+        'tis-620'   => 'iso-8859-11',
         'WinLatin1'     => 'cp1252',
         'WinLatin2'     => 'cp1250',
         'WinCyrillic'   => 'cp1251',
@@ -141,6 +142,7 @@ define_alias(
 print "# alias test with alias overrides\n";
 
 foreach my $a (keys %a2c){     
+    print "# $a => $a2c{$a}\n";
     my $e = Encode::find_encoding($a);
     is((defined($e) and $e->name), $a2c{$a}, "Override $a")
     or warn "alias was $a";
index 3c8a559..9c63630 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: mime-header.t,v 2.2 2006/05/03 18:24:10 dankogai Exp $
+# $Id: mime-header.t,v 2.3 2007/04/06 12:53:41 dankogai Exp dankogai $
 # This script is written in utf8
 #
 BEGIN {
@@ -23,7 +23,7 @@ no utf8;
 
 use strict;
 #use Test::More qw(no_plan);
-use Test::More tests => 11;
+use Test::More tests => 12;
 use_ok("Encode::MIME::Header");
 
 my $eheader =<<'EOS';
@@ -116,4 +116,7 @@ is(Encode::encode('MIME-Q', $dheader), $qheader, "Double decode Q");
     is(Encode::encode('MIME-Q' => $pound_1024), '=?UTF-8?Q?=C2=A31024?=',
        'pound 1024');
 }
+
+is(Encode::encode('MIME-Q', "\x{fc}"), '=?UTF-8?Q?=C3=BC?=', 'Encode latin1 characters');
+
 __END__;