|
|
fde6bc |
From eae18e8bf5fc57ca4e6a07f086fd7205e9c87ed4 Mon Sep 17 00:00:00 2001
|
|
|
fde6bc |
From: Dan Kogai <dankogai+github@gmail.com>
|
|
|
fde6bc |
Date: Sun, 22 Dec 2013 13:07:05 +0900
|
|
|
fde6bc |
Subject: [PATCH] Stringify all decode_utf8() arguments
|
|
|
fde6bc |
MIME-Version: 1.0
|
|
|
fde6bc |
Content-Type: text/plain; charset=UTF-8
|
|
|
fde6bc |
Content-Transfer-Encoding: 8bit
|
|
|
fde6bc |
|
|
|
fde6bc |
Upstream commit:
|
|
|
fde6bc |
|
|
|
fde6bc |
commit 14307cf7e433056128727f5d738ee317ef05b016
|
|
|
fde6bc |
Author: Dan Kogai <dankogai+github@gmail.com>
|
|
|
fde6bc |
Date: Sun Dec 22 13:07:05 2013 +0900
|
|
|
fde6bc |
|
|
|
fde6bc |
VERSION 2.56
|
|
|
fde6bc |
|
|
|
fde6bc |
ported to 2.51.
|
|
|
fde6bc |
|
|
|
fde6bc |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
fde6bc |
---
|
|
|
fde6bc |
Encode.pm | 2 +-
|
|
|
fde6bc |
t/Encode.t | 6 +++++-
|
|
|
fde6bc |
2 files changed, 6 insertions(+), 2 deletions(-)
|
|
|
fde6bc |
|
|
|
fde6bc |
diff --git a/Encode.pm b/Encode.pm
|
|
|
fde6bc |
index 5c30031..b0272ad 100644
|
|
|
fde6bc |
--- a/Encode.pm
|
|
|
fde6bc |
+++ b/Encode.pm
|
|
|
fde6bc |
@@ -211,7 +211,7 @@ sub decode_utf8($;$) {
|
|
|
fde6bc |
my ( $octets, $check ) = @_;
|
|
|
fde6bc |
return $octets if is_utf8($octets);
|
|
|
fde6bc |
return undef unless defined $octets;
|
|
|
fde6bc |
- $octets .= '' if ref $octets;
|
|
|
fde6bc |
+ $octets .= '';
|
|
|
fde6bc |
$check ||= 0;
|
|
|
fde6bc |
$utf8enc ||= find_encoding('utf8');
|
|
|
fde6bc |
my $string = $utf8enc->decode( $octets, $check );
|
|
|
fde6bc |
diff --git a/t/Encode.t b/t/Encode.t
|
|
|
fde6bc |
index 918975e..d490255 100644
|
|
|
fde6bc |
--- a/t/Encode.t
|
|
|
fde6bc |
+++ b/t/Encode.t
|
|
|
fde6bc |
@@ -25,7 +25,7 @@ my @character_set = ('0'..'9', 'A'..'Z', 'a'..'z');
|
|
|
fde6bc |
my @source = qw(ascii iso8859-1 cp1250);
|
|
|
fde6bc |
my @destiny = qw(cp1047 cp37 posix-bc);
|
|
|
fde6bc |
my @ebcdic_sets = qw(cp1047 cp37 posix-bc);
|
|
|
fde6bc |
-plan test => 38+$n*@encodings + 2*@source*@destiny*@character_set + 2*@ebcdic_sets*256 + 6 + 4;
|
|
|
fde6bc |
+plan test => 38+$n*@encodings + 2*@source*@destiny*@character_set + 2*@ebcdic_sets*256 + 6 + 5;
|
|
|
fde6bc |
my $str = join('',map(chr($_),0x20..0x7E));
|
|
|
fde6bc |
my $cpy = $str;
|
|
|
fde6bc |
ok(length($str),from_to($cpy,'iso8859-1','Unicode'),"Length Wrong");
|
|
|
fde6bc |
@@ -150,6 +150,10 @@ package main;
|
|
|
fde6bc |
ok(decode(latin1 => Encode::Dummy->new("foobar")), "foobar");
|
|
|
fde6bc |
ok(encode(utf8 => Encode::Dummy->new("foobar")), "foobar");
|
|
|
fde6bc |
|
|
|
fde6bc |
+# RT#91569
|
|
|
fde6bc |
+# decode_utf8 with non-string arguments
|
|
|
fde6bc |
+ok(decode_utf8(*1), "*main::1");
|
|
|
fde6bc |
+
|
|
|
fde6bc |
# hash keys
|
|
|
fde6bc |
my $key = (keys %{{ "whatever\x{100}" => '' }})[0];
|
|
|
fde6bc |
my $kopy = $key;
|
|
|
fde6bc |
--
|
|
|
fde6bc |
1.8.3.1
|
|
|
fde6bc |
|