diff options
author | Karl Williamson <khw@cpan.org> | 2014-06-03 18:39:40 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-06-05 12:23:02 -0600 |
commit | 5320b60d881861d12d3f678c90a6eafe50077814 (patch) | |
tree | 452faaa5b3c203286444ab7221dde16d04bb4ab3 /lib | |
parent | 2c6ee1a7a1ce7cff7755f9aa43a65b8278dd82a1 (diff) | |
download | perl-5320b60d881861d12d3f678c90a6eafe50077814.tar.gz |
Revert "PATCH: [perl #119499] "$!" with UTF-8 flag"
This reverts commit b17e32ea3ba5ef7362d2a3d1a433661afb897786.
With this commit, the stringification of $! will have the UTF-8 flag set
when the text is actually non-ASCII UTF-8. The reverted commit itself
reverted code that was to fix bugs with this discrepancy of the UTF-8
flag, but which caused backward-compatibility problems with existing
code.
Several things have happened in the interim which allows us to
experimentally resotre the previously reverted changes. One is that
this is early in the 5.21 cycle, and we have plenty of time to see what
negative consequences this may cause. Two is that the returned text
will only be in UTF-8 if the stringification happens within the scope of
'use locale'. This means that the negative effects won't happen for
code, like ack, that is otherwise locale unaware. Third, the 'locale'
pragma has been enhanced to allow the program to only have locale
awareness of LC_MESSAGES.
Code that needs to continue the 5.20 and earlier behavior can do the
stringification within the scopes of both 'use bytes' and 'use locale
":messages". No other Perl operations will be affected by locale; only
$! and $^E stringification. The 'bytes' pragma causes the UTF-8 flag to
not be set, just as in previous Perl releases.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locale.t | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/locale.t b/lib/locale.t index f0457353a7..38b0d09fb3 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -1783,8 +1783,8 @@ foreach my $Locale (@Locale) { $ok13 = $w == 0; # Look for non-ASCII error messages, and verify that the first - # such is NOT in UTF-8 (the others almost certainly will be like - # the first) See [perl #119499]. + # such is in UTF-8 (the others almost certainly will be like the + # first). $ok14 = 1; $ok14_5 = 1; foreach my $err (keys %!) { @@ -1792,7 +1792,7 @@ foreach my $Locale (@Locale) { $! = eval "&Errno::$err"; # Convert to strerror() output my $strerror = "$!"; if ("$strerror" =~ /\P{ASCII}/) { - $ok14 = ! utf8::is_utf8($strerror); + $ok14 = utf8::is_utf8($strerror); no locale; $ok14_5 = "$!" !~ /\P{ASCII}/; last; @@ -1876,7 +1876,7 @@ foreach my $Locale (@Locale) { $problematical_tests{$locales_test_number} = 1; report_result($Locale, ++$locales_test_number, $ok14); - $test_names{$locales_test_number} = 'Verify that non-ASCII UTF-8 error messages are NOT in UTF-8'; + $test_names{$locales_test_number} = 'Verify that non-ASCII UTF-8 error messages are in UTF-8'; report_result($Locale, ++$locales_test_number, $ok14_5); $test_names{$locales_test_number} = '... and are ASCII outside "use locale"'; |