In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/02d357f9024fad2d3c4a537ef2bf8bd962b0d798?hp=f63bc603acea5e0f476f181de698958c4ddcccba>
- Log ----------------------------------------------------------------- commit 02d357f9024fad2d3c4a537ef2bf8bd962b0d798 Author: Karl Williamson <[email protected]> Date: Wed Jan 14 22:48:44 2015 -0700 lib/locale.t: Suppress some warnings Move a 'no warnings' statement to earlier in the file, to before the first possibility of it being needed occurs. M lib/locale.t commit 9de25f670cff2971801ead2abf4fa319eb086936 Author: Karl Williamson <[email protected]> Date: Mon May 20 22:20:29 2013 -0600 lib/locale.t: Generalize to work on non-ASCII M lib/locale.t ----------------------------------------------------------------------- Summary of changes: lib/locale.t | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/locale.t b/lib/locale.t index 8a3d44b..5012d3b 100644 --- a/lib/locale.t +++ b/lib/locale.t @@ -7,6 +7,11 @@ # To make a TODO test, add the string 'TODO' to its %test_names value +my $is_ebcdic = ord("A") == 193; + +no warnings 'locale'; # We test even weird locales; and do some scary things + # in ok locales + binmode STDOUT, ':utf8'; binmode STDERR, ':utf8'; @@ -710,8 +715,6 @@ debug "Scanning for locales...\n"; require POSIX; import POSIX ':locale_h'; -no warnings 'locale'; # We test even weird locales; - my @Locale = find_locales([ &POSIX::LC_CTYPE, &POSIX::LC_NUMERIC, &POSIX::LC_ALL ]); debug "Locales =\n"; @@ -2366,13 +2369,18 @@ setlocale(&POSIX::LC_ALL, "C"); # All casing operations under locale (but not :not_characters) should # taint if ($function =~ /^u/) { - @list = ("", "a", "\xe0", "\xff", "\x{fb00}", "\x{149}", "\x{101}"); - $ascii_case_change_delta = -32; + @list = ("", "a", + chr(utf8::unicode_to_native(0xe0)), + chr(utf8::unicode_to_native(0xff)), + "\x{fb00}", "\x{149}", "\x{101}"); + $ascii_case_change_delta = ($is_ebcdic) ? +64 : -32; $above_latin1_case_change_delta = -1; } else { - @list = ("", "A", "\xC0", "\x{17F}", "\x{100}"); - $ascii_case_change_delta = +32; + @list = ("", "A", + chr(utf8::unicode_to_native(0xC0)), + "\x{17F}", "\x{100}"); + $ascii_case_change_delta = ($is_ebcdic) ? -64 : +32; $above_latin1_case_change_delta = +1; } foreach my $is_utf8_locale (0 .. 1) { @@ -2386,9 +2394,9 @@ setlocale(&POSIX::LC_ALL, "C"); no warnings 'locale'; $should_be = ($j == $#list) ? chr(ord($char) + $above_latin1_case_change_delta) - : (length $char == 0 || ord($char) > 127) - ? $char - : chr(ord($char) + $ascii_case_change_delta); + : (length $char == 0 || utf8::native_to_unicode(ord($char)) > 127) + ? $char + : chr(ord($char) + $ascii_case_change_delta); # This monstrosity is in order to avoid using an eval, # which might perturb the results -- Perl5 Master Repository
