From 5afc789c538836176e8ac85ef914681903a12c66 Mon Sep 17 00:00:00 2001
From: Emmanuel Seyman <emmanuel(a)seyman.fr>
Date: Sun, 25 Dec 2016 19:10:59 +0100
Subject: Apply patch by Petr Pisar to prevent utf8 failures (#1382015)
---
0001-Remove-utf8-option.patch | 91 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
create mode 100644 0001-Remove-utf8-option.patch
diff --git a/0001-Remove-utf8-option.patch b/0001-Remove-utf8-option.patch
new file mode 100644
index 0000000..a6329c7
--- /dev/null
+++ b/0001-Remove-utf8-option.patch
@@ -0,0 +1,91 @@
+From dcd0d8011eeaf7f74a8f03e3600235303e64f7d7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar(a)redhat.com>
+Date: Thu, 22 Dec 2016 13:12:48 +0100
+Subject: [PATCH] Remove utf8 option
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This feature caused test failures since Encode-2.87 because it tried to
+reinterpret input strings as UTF-8 octet stream.
+
+It's application's responsibility to provide input as Unicode strings.
+This how Perl works.
+
+CPAN RT#118483
+
+Signed-off-by: Petr Písař <ppisar(a)redhat.com>
+---
+ lib/Text/ASCIITable.pm | 2 --
+ t/03_options.t | 3 ++-
+ t/13_utf8.t | 5 +++--
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/lib/Text/ASCIITable.pm b/lib/Text/ASCIITable.pm
+index b630910..c4449e0 100644
+--- a/lib/Text/ASCIITable.pm
++++ b/lib/Text/ASCIITable.pm
+@@ -88,7 +88,6 @@ sub new {
+ $self->{options}{alignHeadRow} = $self->{options}{alignHeadRow} ||
'auto'; # default setting
+ $self->{options}{undef_as} = $self->{options}{undef_as} || ''; # default
setting
+ $self->{options}{chaining} = $self->{options}{chaining} || 0; # default setting
+- $self->{options}{utf8} = defined($self->{options}{utf8}) ?
$self->{options}{utf8} : 1; # default setting
+
+ bless $self;
+
+@@ -884,7 +883,6 @@ sub count {
+ $str =~ s/<.+?>//g if $self->{options}{allowHTML};
+ $str =~ s/\33\[(\d+(;\d+)?)?[musfwhojBCDHRJK]//g if $self->{options}{allowANSI}; #
maybe i should only have allowed ESC[#;#m and not things not related to
+ $str =~ s/\33\([0B]//g if $self->{options}{allowANSI}; #
color/bold/underline.. But I want to give people as much room as they need.
+- $str = decode("utf8", $str) if $self->{options}{utf8};
+
+ return length($str);
+ }
+diff --git a/t/03_options.t b/t/03_options.t
+index d8ef530..162c286 100644
+--- a/t/03_options.t
++++ b/t/03_options.t
+@@ -2,6 +2,7 @@
+
+ BEGIN { $| = 1; print "1..6\n"; }
+ END {print "not ok 1\n" unless $loaded;}
++use utf8;
+ use Text::ASCIITable;
+ $loaded = 1;
+ print "ok 1\n";
+@@ -9,7 +10,7 @@ $i=2;
+
+ $t = new Text::ASCIITable({ hide_LastLine => 1, hide_HeadLine => 1 });
+ ok($t->setCols(['id','nick','name']));
+-ok($t->addRow('1','Lunatic-|','H�kon Nessj�en'));
++ok($t->addRow('1','Lunatic-|','Håkon Nessjøen'));
+ $t->addRow('2','tesepe','William Viker');
+ $t->addRow('3','espen','Espen Ursin-Holm');
+ $t->addRow('4','bonde','Martin Mikkelsen');
+diff --git a/t/13_utf8.t b/t/13_utf8.t
+index d0ef858..59649f2 100644
+--- a/t/13_utf8.t
++++ b/t/13_utf8.t
+@@ -2,6 +2,7 @@
+
+ BEGIN { $| = 1; print "1..6\n"; }
+ END {print "not ok 1\n" unless $loaded;}
++use utf8;
+ use Text::ASCIITable;
+ $loaded = 1;
+ print "ok 1\n";
+@@ -18,9 +19,9 @@ eval {
+ };
+ if (!$@) {ok(undef)} else {ok(1)}
+ @arr = split(/\n/,$content);
+-ok(length($arr[3]) < length($arr[4])?undef:1);
++ok(length($arr[3]) == length($arr[4])?undef:1);
+ ok(length($arr[3]) == $t->getTableWidth()?undef:1);
+-ok(length($arr[6]) > $t->getTableWidth()?undef:1);
++ok(length($arr[6]) == $t->getTableWidth()?undef:1);
+ if (scalar(@arr) == 8) {ok(undef);} else {ok(1);}
+
+ sub ok{print(defined(shift)?"not ok $i\n":"ok $i\n");$i++;}
+--
+2.7.4
+
--
cgit v0.12
http://pkgs.fedoraproject.org/cgit/perl-Text-ASCIITable.git/commit/?h=mas...