From b2b7346bfc59caff514d997701e0e086b983c863 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 29 May 2011 20:39:33 -0700 Subject: 2nd try: [perl #91834] utf8::decode does not respect copy-on-write I reverted the first version of this patch because I put the if() statement before a declaration. I did a revert, rather than a correc- tion, to make back-porting easier. --- lib/utf8.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/utf8.t b/lib/utf8.t index ae81ccdc46..b13bb5377d 100644 --- a/lib/utf8.t +++ b/lib/utf8.t @@ -426,6 +426,18 @@ SKIP: { "utf8::encode should refuse to touch read-only values"); } +{ + # Make sure utf8::decode respects copy-on-write [perl #91834]. + # Hash keys are the easiest way to test this. + my $name = "\x{c3}\x{b3}"; + my ($k1) = keys %{ { $name=>undef } }; + my $k2 = $name; + utf8::decode($k1); + utf8::decode($k2); + my $h = { $k1 => 1, $k2 => 2 }; + is join('', keys $h), $k2, 'utf8::decode respects copy-on-write'; +} + { my $a = "456\xb6"; utf8::upgrade($a); -- cgit v1.2.1