From: Jarkko Hietaniemi Date: Thu, 6 Feb 2003 04:03:31 +0000 (+0000) Subject: Upgrade to Encode 1.87. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=151b5d361063dc7eb9d8b6b2fdaaa3560e39071e;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Encode 1.87. p4raw-id: //depot/perl@18663 --- diff --git a/ext/Encode/AUTHORS b/ext/Encode/AUTHORS index c559c84..3f20c7e 100644 --- a/ext/Encode/AUTHORS +++ b/ext/Encode/AUTHORS @@ -22,6 +22,7 @@ Graham Barr Gurusamy Sarathy H.Merijn Brand Hugo van der Sanden +Inaba HIroto Jarkko Hietaniemi Jungshik Shin Laszlo Molnar @@ -35,6 +36,7 @@ Paul Marquess Philip Newton Robin Barker SADAHIRO Tomoyuki +SUZUKI Norio Spider Boardman Tatsuhiko Miyagawa Vadim Konovalov diff --git a/ext/Encode/Byte/Byte.pm b/ext/Encode/Byte/Byte.pm index 745ca3c..638a992 100644 --- a/ext/Encode/Byte/Byte.pm +++ b/ext/Encode/Byte/Byte.pm @@ -1,6 +1,6 @@ package Encode::Byte; use Encode; -our $VERSION = do { my @r = (q$Revision: 1.22 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.23 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use XSLoader; XSLoader::load(__PACKAGE__,$VERSION); @@ -51,7 +51,7 @@ supported are as follows. # Vietnamese viscii - + # all cp* are also available as ibm-*, ms-*, and windows-* # also see L diff --git a/ext/Encode/Changes b/ext/Encode/Changes index 6872c60..f327441 100644 --- a/ext/Encode/Changes +++ b/ext/Encode/Changes @@ -1,9 +1,32 @@ # Revision history for Perl extension Encode. # -# $Id: Changes,v 1.86 2003/01/22 03:29:07 dankogai Exp $ +# $Id: Changes,v 1.87 2003/02/06 01:52:11 dankogai Exp dankogai $ # -$Revision: 1.86 $ $Date: 2003/01/22 03:29:07 $ +$Revision: 1.87 $ $Date: 2003/02/06 01:52:11 $ +! AUTHORS + * Inaba "Sensei" Hirohito added (I thought I have done so a long + ago but apparently I did not). + * SUZUKI Norio added for verious and useful bug reports. +! Byte/Byte.pm KR/KR.pm Unicode/Unicode.pm + lib/Encode/Encoder.pm lib/Encode/CJKConstants.pm + podchecked so all warnings are gone except for L. +! encoding.pm t/enc_eucjp.t + * t/uni/tr_utf8.t now t ok on maintperl (sorry, jhi) + * Filter option overhaul + * POD revision +! Encode.pm Encode.xs encengine.c Encode/encode.h + lib/Encode/Encoding.pm lib/Encode/JP/JIS7.pm + Merged inaba-san's patch that fixes "use encoding 'shiftjis'" + without filter. podchecked by Dan Kogai. + Message-Id: <3E3BC46B.6C687CFD@st.rim.or.jp> +! lib/Encode/Alias.pm + decode('alias', $1) went wild because of local $_ in find_alias() + the evil local $_ is eradicated but that changes find_alias() + format for coderef aliasing. See Encode::Alias for details + Message-Id: <200302051704.AA00042@kipp0.nifty.com> + +1.86 2003/01/22 03:29:07 ! encoding.pm * Don't forget to canonize when you attempt an exact match! Message-Id: <73E7F801-2DAA-11D7-BF9A-000393AE4244@dan.co.jp> diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 548c5ab..f123bab 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -1,9 +1,9 @@ # -# $Id: Encode.pm,v 1.86 2003/01/22 03:30:40 dankogai Exp $ +# $Id: Encode.pm,v 1.87 2003/02/06 01:52:11 dankogai Exp dankogai $ # package Encode; use strict; -our $VERSION = do { my @r = (q$Revision: 1.86 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.87 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our $DEBUG = 0; use XSLoader (); XSLoader::load(__PACKAGE__, $VERSION); @@ -543,12 +543,12 @@ except for hz and ISO-2022-kr. For gory details, see L and L< =head1 Handling Malformed Data -=over 2 - The I argument is used as follows. When you omit it, the behaviour is the same as if you had passed a value of 0 for I. +=over 2 + =item I = Encode::FB_DEFAULT ( == 0) If I is 0, (en|de)code will put a I @@ -622,6 +622,8 @@ constants via C. HTMLCREF 0x0200 XMLCREF 0x0400 +=back + =head2 Unimplemented fallback schemes In the future, you will be able to use a code reference to a callback @@ -690,7 +692,7 @@ Here is how Encode takes care of the utf8 flag. When you encode, the resulting utf8 flag is always off. -=item +=item * When you decode, the resulting utf8 flag is on unless you can unambiguously represent data. Here is the definition of diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index c4cb98e..0462a5d 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -1,5 +1,5 @@ /* - $Id: Encode.xs,v 1.52 2002/11/18 17:28:49 dankogai Exp $ + $Id: Encode.xs,v 1.53 2003/02/06 01:52:11 dankogai Exp dankogai $ */ #define PERL_NO_GET_CONTEXT diff --git a/ext/Encode/KR/KR.pm b/ext/Encode/KR/KR.pm index 55bd9c0..16f39b2 100644 --- a/ext/Encode/KR/KR.pm +++ b/ext/Encode/KR/KR.pm @@ -4,7 +4,7 @@ BEGIN { die "Encode::KR not supported on EBCDIC\n"; } } -our $VERSION = do { my @r = (q$Revision: 1.22 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.23 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Encode; use XSLoader; @@ -46,7 +46,7 @@ are as follows. Annex 3 of KS X 1001:1998 iso-2022-kr iso-2022-kr [RFC1557] -------------------------------------------------------------------- - + To find how to use this module in detail, see L. =head1 BUGS diff --git a/ext/Encode/Unicode/Unicode.pm b/ext/Encode/Unicode/Unicode.pm index fa508eb..bcd698a 100644 --- a/ext/Encode/Unicode/Unicode.pm +++ b/ext/Encode/Unicode/Unicode.pm @@ -3,7 +3,7 @@ package Encode::Unicode; use strict; use warnings; -our $VERSION = do { my @r = (q$Revision: 1.37 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.38 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use XSLoader; XSLoader::load(__PACKAGE__,$VERSION); @@ -358,7 +358,7 @@ endianness is prepended to the string. ------------------------- =back - + This modules handles the BOM as follows. =over 4 diff --git a/ext/Encode/Unicode/Unicode.xs b/ext/Encode/Unicode/Unicode.xs index 52484dd..6cd3950 100644 --- a/ext/Encode/Unicode/Unicode.xs +++ b/ext/Encode/Unicode/Unicode.xs @@ -113,7 +113,7 @@ CODE: endian = 'V'; } else { - croak("%"SVf": Unrecognised BOM %"UVxf, + croak("%"SVf":Unregognised BOM %"UVxf, *hv_fetch((HV *)SvRV(obj),"Name",4,0), bom); } diff --git a/ext/Encode/encoding.pm b/ext/Encode/encoding.pm index 1681034..ec3cf57 100644 --- a/ext/Encode/encoding.pm +++ b/ext/Encode/encoding.pm @@ -1,8 +1,9 @@ package encoding; -our $VERSION = do { my @r = (q$Revision: 1.40 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.41 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Encode; use strict; +our $DEBUG = 0; BEGIN { if (ord("A") == 193) { @@ -17,15 +18,22 @@ unless ($@){ $HAS_PERLIO = (PerlIO::encoding->VERSION >= 0.02); } -my %utfs = map {$_=>1} - qw(utf8 UCS-2BE UCS-2LE UTF-16 UTF-16BE UTF-16LE UTF-32 UTF-32BE UTF-32LE); +sub _exception{ + my $name = shift; + $] > 5.008 and return 0; # 5.8.1 then no + my %utfs = map {$_=>1} + qw(utf8 UCS-2BE UCS-2LE UTF-16 UTF-16BE UTF-16LE + UTF-32 UTF-32BE UTF-32LE); + $utfs{$name} or return 0; # UTFs or no + require Config; Config->import(); our %Config; + return $Config{perl_patchlevel} == 0 # maintperl then no +} sub import { my $class = shift; my $name = shift; my %arg = @_; $name ||= $ENV{PERL_ENCODING}; - my $enc = find_encoding($name); unless (defined $enc) { require Carp; @@ -33,45 +41,47 @@ sub import { } $name = $enc->name; # canonize unless ($arg{Filter}) { - ${^ENCODING} = $enc unless $] <= 5.008 and $utfs{$name}; + $DEBUG and warn "_exception($name) = ", _exception($name); + _exception($name) or ${^ENCODING} = $enc; $HAS_PERLIO or return 1; - for my $h (qw(STDIN STDOUT)){ - if ($arg{$h}){ - unless (defined find_encoding($arg{$h})) { - require Carp; - Carp::croak("Unknown encoding for $h, '$arg{$h}'"); - } - eval { binmode($h, ":encoding($arg{$h})") }; - }else{ - unless (exists $arg{$h}){ - eval { - no warnings 'uninitialized'; - binmode($h, ":encoding($name)"); - }; - } - } - if ($@){ - require Carp; - Carp::croak($@); - } - } }else{ defined(${^ENCODING}) and undef ${^ENCODING}; + # implicitly 'use utf8' + require utf8; # to fetch $utf8::hint_bits; + $^H |= $utf8::hint_bits; eval { require Filter::Util::Call ; Filter::Util::Call->import ; - binmode(STDIN); - binmode(STDOUT); filter_add(sub{ - my $status; - if (($status = filter_read()) > 0){ + my $status = filter_read(); + if ($status > 0){ + # $DEBUG and warn $_; $_ = $enc->decode($_, 1); - # warn $_; + $DEBUG and warn $_; } $status ; }); }; - # warn "Filter installed"; + } $DEBUG and warn "Filter installed"; + for my $h (qw(STDIN STDOUT)){ + if ($arg{$h}){ + unless (defined find_encoding($arg{$h})) { + require Carp; + Carp::croak("Unknown encoding for $h, '$arg{$h}'"); + } + eval { binmode($h, ":encoding($arg{$h})") }; + }else{ + unless (exists $arg{$h}){ + eval { + no warnings 'uninitialized'; + binmode($h, ":encoding($name)"); + }; + } + } + if ($@){ + require Carp; + Carp::croak($@); + } } return 1; # I doubt if we need it, though } @@ -120,7 +130,6 @@ encoding - allows you to write your script in non-ascii or non-utf8 # an alternate way, Filter use encoding "euc-jp", Filter=>1; - use utf8; # now you can use kanji identifiers -- in euc-jp! =head1 ABSTRACT @@ -185,6 +194,13 @@ C<< STDIN => I >> form. In this case, you cannot omit the first I. C<< STDIN => undef >> turns the IO transcoding completely off. +=item use encoding I Filter=E1; + +This turns the encoding pragma into a source filter. While the +default approach just decodes interpolated literals (in qq() and +qr()), this will apply a source filter to the entire source code. See +L below for details + =item no encoding; Unsets the script encoding. The disciplines of STDIN, STDOUT are @@ -192,6 +208,41 @@ reset to ":raw" (the default unprocessed raw stream of bytes). =back +=head1 The Filter Option + +The magic of C is not applied to the names of +identifiers. In order to make C<${"\x{4eba}"}++> ($human++, where human +is a single Han ideograph) work, you still need to write your script +in UTF-8 -- or use a source filter. That's what 'Filter=>1' does. + + +What does this mean? Your source code behaves as if it is written in +UTF-8 with 'use utf8' in effect. So even if your editor only supports +Shift_JIS, for example, you can still try examples in Chapter 15 of +C. For instance, you can use UTF-8 +identifiers. + +This option is significantly slower and (as of this writing) non-ASCII +identifiers are not very stable WITHOUT this option and with the +source code written in UTF-8. + +=head2 Filter-related changes at Encode version 1.87 + +=over + +=item * + +The Filter option now sets STDIN and STDOUT like non-filter options. +And C<< STDIN=>I >> and C<< STDOUT=>I >> work like +non-filter version. + +=item * + +C is implicitly declared so you no longer have to C to C<${"\x{4eba}"}++>. + +=back + =head1 CAVEATS =head2 NOT SCOPED @@ -241,10 +292,37 @@ resort to \x{....} just to spell your name in a native encoding. So feel free to put your strings in your encoding in quotes and regexes. -=head2 tr/// with ranges remain unaffected +=head2 format doesn't work well + +This pragma doesn't work well with format because PerlIO does not +get along very well with it. When format contains non-ascii +characters it prints funny or gets "wide character warnings". +To understand it, try the code below. + + # Save this one in utf8 + # replace *non-ascii* with a non-ascii string + my $camel; + format STDOUT = + *non-ascii*@>>>>>>> + $camel + . + $camel = "*non-ascii*"; + binmode(STDOUT=>':encoding(utf8)'); # bang! + write; # funny + print $camel, "\n"; # fine + +Without binmode this happens to work but without binmode, print() +fails instead of write(). + +At any rate, the very use of format is questionable when it comes to +unicode characters since you have to consider such things as character +width (i.e. double-width for ideographs) and directions (i.e. BIDI for +Arabic and Hebrew). + +=head2 tr/// with ranges The B pragma works by decoding string literals in -C and so forth. As of perl 5.8.0, this +C and so forth. In perl 5.8.0, this does not apply to C. Therefore, use encoding 'euc-jp'; @@ -269,12 +347,15 @@ Does not work as =back +This counterintuitive behavior has been fixed in perl 5.8.1 and up +by INABA Hirohito. + =head3 workaround to tr///; -You can, however, achieve the same as simply as follows; +In perl 5.8.0, you can work aroud as follows; use encoding 'euc-jp'; - # .... + # .... eval qq{ \$kana =~ tr/\xA4\xA1-\xA4\xF3/\xA5\xA1-\xA5\xF3/ }; Note the C expression is surronded by C. The idea behind @@ -285,42 +366,7 @@ is the same as classic idiom that makes C 'interpolate'. Nevertheless, in case of B pragma even C is affected so C not being decoded was obviously against the will of Perl5 -Porters. In future version of perl, this counter-intuitive behaviour -of C will be fixed so C trick will be unneccesary. - -=head1 Non-ASCII Identifiers and Filter option - -The magic of C is not applied to the names of -identifiers. In order to make C<${"\x{4eba}"}++> ($human++, where human -is a single Han ideograph) work, you still need to write your script -in UTF-8 or use a source filter. - -In other words, the same restriction as with Jperl applies. - -If you dare to experiment, however, you can try the Filter option. - -=over 4 - -=item use encoding I Filter=E1; - -This turns the encoding pragma into a source filter. While the default -approach just decodes interpolated literals (in qq() and qr()), this -will apply a source filter to the entire source code. In this case, -STDIN and STDOUT remain untouched. - -=back - -What does this mean? Your source code behaves as if it is written in -UTF-8. So even if your editor only supports Shift_JIS, for example, -you can still try examples in Chapter 15 of C. For instance, you can use UTF-8 identifiers. - -This option is significantly slower and (as of this writing) non-ASCII -identifiers are not very stable WITHOUT this option and with the -source code written in UTF-8. - -To make your script in legacy encoding work with minimum effort, -do not use Filter=E1. +Porters so it has been fixed. =head1 EXAMPLE - Greekperl @@ -357,14 +403,22 @@ do not use Filter=E1. =head1 KNOWN PROBLEMS +=over + +=item * + For native multibyte encodings (either fixed or variable length), the current implementation of the regular expressions may introduce recoding errors for regular expression literals longer than 127 bytes. +=item * + The encoding pragma is not supported on EBCDIC platforms. (Porters who are willing and able to remove this limitation are welcome.) +=back + =head1 SEE ALSO L, L, L, L, diff --git a/ext/Encode/lib/Encode/Alias.pm b/ext/Encode/lib/Encode/Alias.pm index 0622602..7dbc47b 100644 --- a/ext/Encode/lib/Encode/Alias.pm +++ b/ext/Encode/lib/Encode/Alias.pm @@ -1,7 +1,7 @@ package Encode::Alias; use strict; use Encode; -our $VERSION = do { my @r = (q$Revision: 1.34 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.35 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our $DEBUG = 0; use base qw(Exporter); @@ -20,38 +20,38 @@ our %Alias; # cached known aliases sub find_alias { my $class = shift; - local $_ = shift; - unless (exists $Alias{$_}) + my $find = shift; + unless (exists $Alias{$find}) { - $Alias{$_} = undef; # Recursion guard + $Alias{$find} = undef; # Recursion guard for (my $i=0; $i < @Alias; $i += 2) { my $alias = $Alias[$i]; my $val = $Alias[$i+1]; my $new; - if (ref($alias) eq 'Regexp' && $_ =~ $alias) + if (ref($alias) eq 'Regexp' && $find =~ $alias) { $DEBUG and warn "eval $val"; $new = eval $val; - # $@ and warn "$val, $@"; + $DEBUG and $@ and warn "$val, $@"; } elsif (ref($alias) eq 'CODE') { - $DEBUG and warn "$alias", "->", "($val)"; - $new = $alias->($val); + $DEBUG and warn "$alias", "->", "($find)"; + $new = $alias->($find); } - elsif (lc($_) eq lc($alias)) + elsif (lc($find) eq lc($alias)) { $new = $val; } if (defined($new)) { - next if $new eq $_; # avoid (direct) recursion on bugs + next if $new eq $find; # avoid (direct) recursion on bugs $DEBUG and warn "$alias, $new"; my $enc = (ref($new)) ? $new : Encode::find_encoding($new); if ($enc) { - $Alias{$_} = $enc; + $Alias{$find} = $enc; last; } } @@ -59,14 +59,14 @@ sub find_alias } if ($DEBUG){ my $name; - if (my $e = $Alias{$_}){ + if (my $e = $Alias{$find}){ $name = $e->name; }else{ $name = ""; } - warn "find_alias($class, $_)->name = $name"; + warn "find_alias($class, $find)->name = $name"; } - return $Alias{$_}; + return $Alias{$find}; } sub define_alias @@ -277,21 +277,43 @@ in order to allow C<$1> etc. to be substituted. The example is one way to alias names as used in X11 fonts to the MIME names for the iso-8859-* family. Note the double quotes inside the single quotes. +(or, you don't have to do this yourself because this example is predefined) + If you are using a regex here, you have to use the quotes as shown or it won't work. Also note that regex handling is tricky even for the -experienced. Use it with caution. +experienced. Use this feature with caution. =item As a code reference, e.g.: - define_alias( sub { return /^iso8859-(\d+)$/i ? "iso-8859-$1" : undef } , ''); + define_alias( sub {shift =~ /^iso8859-(\d+)$/i ? "iso-8859-$1" : undef } ); -In this case, C<$_> will be set to the name that is being looked up and -I is passed to the sub as its first argument. The example -is another way to alias names as used in X11 fonts to the MIME names -for the iso-8859-* family. +The same effect as the example above in a different way. The coderef +takes the alias name as an argument and returns a canonical name on +success or undef if not. Note the second argument is not required. +Use this with even more caution than the regex version. =back +=head3 Changes in code reference aliasing + +As of Encode 1.87, the older form + + define_alias( sub { return /^iso8859-(\d+)$/i ? "iso-8859-$1" : undef } ); + +no longer works. + +Encode up to 1.86 internally used "local $_" to implement ths older +form. But consider the code below; + + use Encode; + $_ = "eeeee" ; + while (/(e)/g) { + my $utf = decode('aliased-encoding-name', $1); + print "position:",pos,"\n"; + } + +Prior to Encode 1.86 this fails because of "local $_". + =head2 Alias overloading You can override predefined aliases by simply applying define_alias(). diff --git a/ext/Encode/lib/Encode/CJKConstants.pm b/ext/Encode/lib/Encode/CJKConstants.pm index 4ddf2ae..e90e854 100644 --- a/ext/Encode/lib/Encode/CJKConstants.pm +++ b/ext/Encode/lib/Encode/CJKConstants.pm @@ -1,13 +1,13 @@ # -# $Id: CJKConstants.pm,v 1.0 2002/03/28 23:26:28 dankogai Exp $ +# $Id: CJKConstants.pm,v 1.1 2003/02/06 01:52:11 dankogai Exp dankogai $ # package Encode::CJKConstants; use strict; -our $RCSID = q$Id: CJKConstants.pm,v 1.0 2002/03/28 23:26:28 dankogai Exp $; -our $VERSION = do { my @r = (q$Revision: 1.0 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $RCSID = q$Id: CJKConstants.pm,v 1.1 2003/02/06 01:52:11 dankogai Exp dankogai $; +our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Carp; @@ -60,6 +60,6 @@ our %RE = =head1 NAME - Encode::CJKConstants.pm -- Internally used by Encode::??::ISO_2022_* +Encode::CJKConstants.pm -- Internally used by Encode::??::ISO_2022_* =cut diff --git a/ext/Encode/lib/Encode/Encoder.pm b/ext/Encode/lib/Encode/Encoder.pm index 6536ed2..8f65bdb 100644 --- a/ext/Encode/lib/Encode/Encoder.pm +++ b/ext/Encode/lib/Encode/Encoder.pm @@ -1,10 +1,10 @@ # -# $Id: Encoder.pm,v 0.5 2002/04/22 02:45:50 dankogai Exp $ +# $Id: Encoder.pm,v 0.6 2003/02/06 01:52:11 dankogai Exp dankogai $ # package Encode::Encoder; use strict; use warnings; -our $VERSION = do { my @r = (q$Revision: 0.5 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 0.6 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; require Exporter; our @ISA = qw(Exporter); @@ -101,7 +101,7 @@ __END__ Encode::Encoder -- Object Oriented Encoder =head1 SYNOPSIS - + use Encode::Encoder; # Encode::encode("ISO-8859-1", $data); Encode::Encoder->new($data)->iso_8859_1; # OOP way diff --git a/ext/Encode/lib/Encode/Encoding.pm b/ext/Encode/lib/Encode/Encoding.pm index 4e842b6..7ec9bf8 100644 --- a/ext/Encode/lib/Encode/Encoding.pm +++ b/ext/Encode/lib/Encode/Encoding.pm @@ -1,7 +1,7 @@ package Encode::Encoding; # Base class for classes which implement encodings use strict; -our $VERSION = do { my @r = (q$Revision: 1.30 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.31 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; require Encode; @@ -137,6 +137,8 @@ Decoding will terminate when $terminator (a string) appears in output. I<$offset> will be modified to the last $octets position at end of decode. Returns true if $terminator appears output, else returns false. +=back + =head2 Other methods defined in Encode::Encodings You do not have to override methods shown below unless you have to. diff --git a/ext/Encode/lib/Encode/JP/JIS7.pm b/ext/Encode/lib/Encode/JP/JIS7.pm index 52e5e5c..d194c5a 100644 --- a/ext/Encode/lib/Encode/JP/JIS7.pm +++ b/ext/Encode/lib/Encode/JP/JIS7.pm @@ -1,7 +1,7 @@ package Encode::JP::JIS7; use strict; -our $VERSION = do { my @r = (q$Revision: 1.9 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.10 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Encode qw(:fallbacks); diff --git a/ext/Encode/t/CJKT.t b/ext/Encode/t/CJKT.t index 72e5d3c..5421f23 100644 --- a/ext/Encode/t/CJKT.t +++ b/ext/Encode/t/CJKT.t @@ -57,7 +57,7 @@ for my $charset (sort keys %Charset){ open $src, "<$src_enc" or die "$src_enc : $!"; - binmode($src); # needed if UTF-8 locales enabled! + # binmode($src); # not needed! $txt = join('',<$src>); close($src); diff --git a/ext/Encode/t/enc_eucjp.t b/ext/Encode/t/enc_eucjp.t index 8bc1f4d..4929d7e 100644 --- a/ext/Encode/t/enc_eucjp.t +++ b/ext/Encode/t/enc_eucjp.t @@ -1,12 +1,8 @@ -# $Id: enc_eucjp.t,v 1.1 2003/01/21 22:19:14 dankogai Exp $ +# $Id: enc_eucjp.t,v 1.2 2003/02/06 01:52:11 dankogai Exp dankogai $ # This is the twin of enc_utf8.t, the only difference is that # this has "use encoding 'euc-jp'". BEGIN { - if ($] <= 5.008){ - print "1..0 # Skip: Perl 5.8.1 or later required\n"; - exit 0; - } require Config; import Config; if ($Config{'extensions'} !~ /\bEncode\b/) { print "1..0 # Skip: Encode was not built\n"; @@ -20,6 +16,10 @@ BEGIN { print "1..0 # encoding pragma does not support EBCDIC platforms\n"; exit(0); } + if ($] <= 5.008 and !$Config{perl_patchlevel}){ + print "1..0 # Skip: Perl 5.8.1 or later required\n"; + exit 0; + } } use encoding 'euc-jp';