summaryrefslogtreecommitdiff
path: root/ext/Encode/lib
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-05-04 15:58:53 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-04 15:58:53 +0000
commit11067275d7d22484009dab2a975f2c8c28f4daf3 (patch)
treed3c058132a728fd19bc344406d8d1fec63df75c7 /ext/Encode/lib
parent64fa5b0baf3802c24eefe0e0dfe2be71992aecb5 (diff)
downloadperl-11067275d7d22484009dab2a975f2c8c28f4daf3.tar.gz
Upgrade to Encode 1.69.
p4raw-id: //depot/perl@16392
Diffstat (limited to 'ext/Encode/lib')
-rw-r--r--ext/Encode/lib/Encode/Alias.pm12
-rw-r--r--ext/Encode/lib/Encode/Guess.pm4
-rw-r--r--ext/Encode/lib/Encode/MIME/Header.pm6
3 files changed, 12 insertions, 10 deletions
diff --git a/ext/Encode/lib/Encode/Alias.pm b/ext/Encode/lib/Encode/Alias.pm
index a6172ed3a9..1cc54bf7fa 100644
--- a/ext/Encode/lib/Encode/Alias.pm
+++ b/ext/Encode/lib/Encode/Alias.pm
@@ -128,13 +128,13 @@ sub init_aliases
define_alias( qr/^(.*)$/ => '"\L$1"' );
# UTF/UCS stuff
- define_alias( qr/^UCS-?2-?LE$/i => '"UCS-2LE"' );
- define_alias( qr/^UCS-?2-?(BE)?$/i => '"UCS-2BE"',
+ define_alias( qr/^UCS-?2-?LE$/i => '"UCS-2LE"' );
+ define_alias( qr/^UCS-?2-?(BE)?$/i => '"UCS-2BE"',
qr/^UCS-?4-?(BE|LE)?$/i => 'uc("UTF-32$1")',
- qr/^iso-10646-1$/i => '"UCS-2BE"' );
- define_alias( qr/^UTF(16|32)-?BE$/i => '"UTF-$1BE"',
- qr/^UTF(16|32)-?LE$/i => '"UTF-$1LE"',
- qr/^UTF(16|32)$/i => '"UTF-$1"',
+ qr/^iso-10646-1$/i => '"UCS-2BE"' );
+ define_alias( qr/^UTF(16|32)-?BE$/i => '"UTF-$1BE"',
+ qr/^UTF(16|32)-?LE$/i => '"UTF-$1LE"',
+ qr/^UTF(16|32)$/i => '"UTF-$1"',
);
# ASCII
define_alias(qr/^(?:US-?)ascii$/i => '"ascii"');
diff --git a/ext/Encode/lib/Encode/Guess.pm b/ext/Encode/lib/Encode/Guess.pm
index b106a0457c..f4bfbfa664 100644
--- a/ext/Encode/lib/Encode/Guess.pm
+++ b/ext/Encode/lib/Encode/Guess.pm
@@ -2,7 +2,7 @@ package Encode::Guess;
use strict;
use Encode qw(:fallbacks find_encoding);
-our $VERSION = do { my @r = (q$Revision: 1.5 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.6 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
my $Canon = 'Guess';
our $DEBUG = 0;
@@ -87,7 +87,7 @@ sub guess {
$DEBUG and warn "Added: ", $e->name;
}
my $nline = 1;
- for my $line (split /\r|\n|\r\n/, $octet){
+ for my $line (split /\r\n?|\n/, $octet){
# cheat 2 -- \e in the string
if ($line =~ /\e/o){
my @keys = keys %try;
diff --git a/ext/Encode/lib/Encode/MIME/Header.pm b/ext/Encode/lib/Encode/MIME/Header.pm
index 683348a985..09dd55e0db 100644
--- a/ext/Encode/lib/Encode/MIME/Header.pm
+++ b/ext/Encode/lib/Encode/MIME/Header.pm
@@ -1,7 +1,7 @@
package Encode::MIME::Header;
use strict;
# use warnings;
-our $VERSION = do { my @r = (q$Revision: 1.3 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+our $VERSION = do { my @r = (q$Revision: 1.4 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
use Encode qw(find_encoding encode_utf8);
use MIME::Base64;
@@ -128,7 +128,9 @@ sub _encode{
my ($o, $str) = @_;
my $enc = $o->{encode};
my $llen = ($o->{bpl} - length(HEAD) - 2 - length(TAIL));
- $llen *= $enc eq 'B' ? 3/4 : 1/3;
+ # to coerce a floating-point arithmetics, the following contains
+ # .0 in numbers -- dankogai
+ $llen *= $enc eq 'B' ? 3.0/4.0 : 1.0/3.0;
my @result = ();
my $chunk = '';
while(my $chr = substr($str, 0, 1, '')){