From d30553598b9a36dc7e48770337611be88403d643 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 13 May 2021 10:15:28 +0000 Subject: Rework Data::Dumper Unicode-in-qr support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This approach (and this commit message) are based on Aaron Crane's original in GH #18771. However, we leave the pure-Perl Dump unchanged (which means changing the tests somewhat), and need to handle one more corner case (\x{...} escaping a Unicode character that follows a backslash). The previous approach was to upgrade the output to the internal UTF-8 encoding when dumping a regex containing supra-Latin-1 characters. That has the disadvantage that nothing else generates wide characters in the output, or even knows that the output might be upgraded. A better approach, and one that's more consistent with the one taken for string literals, is to use `\x{…}` notation where needed. Closes #18764 --- dist/Data-Dumper/t/dumper.t | 6 ------ 1 file changed, 6 deletions(-) (limited to 'dist/Data-Dumper/t') diff --git a/dist/Data-Dumper/t/dumper.t b/dist/Data-Dumper/t/dumper.t index af8c10308a..f05449e849 100644 --- a/dist/Data-Dumper/t/dumper.t +++ b/dist/Data-Dumper/t/dumper.t @@ -1734,9 +1734,6 @@ EOW TEST qq(Data::Dumper->Dump([ [qq/\x{41f}/, qr/\x{8b80}/, qr/\x{41f}/, qr/\x{e4}/, "\xE4"] ])), "string with Unicode + regexp with Unicode"; - SKIP_TEST "skipped, pending fix for github #18764"; - last; - $WANT =~ s/'\xE4'/"\\x{e4}"/; $WANT =~ s<([^\0-\177])> ge; TEST qq(Data::Dumper->Dumpxs([ [qq/\x{41f}/, qr/\x{8b80}/, qr/\x{41f}/, qr/\x{e4}/, "\xE4"] ])), @@ -1797,9 +1794,6 @@ EOW TEST qq(Data::Dumper->Dump([ [ '\x{2e18}', qr! \x{203d}/ !, qr! \\\x{203d}/ !, qr! \\\x{203d}$bs:/ !, "\xa3"] ])), "github #18614, github #18764, perl #58608 corner cases"; - SKIP_TEST "skipped, pending fix for github #18764"; - last; - $WANT =~ s/'\x{A3}'/"\\x{a3}"/; $WANT =~ s/\x{203D}/\\x{203d}/g; TEST qq(Data::Dumper->Dumpxs([ [ '\x{2e18}', qr! \x{203d}/ !, qr! \\\x{203d}/ !, qr! \\\x{203d}$bs:/ !, "\xa3"] ])), -- cgit v1.2.1