summaryrefslogtreecommitdiff
path: root/lib/locale.t
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-06-06 13:08:17 -0600
committerKarl Williamson <khw@cpan.org>2014-06-07 10:24:59 -0600
commit9717af6d049902fc887c412facb2d15e785ef1a4 (patch)
treebfc511fcbe55465cfb3b7d819deef013d3086724 /lib/locale.t
parentf406a44534fb208bbd0ef2f84f722d1693b498a4 (diff)
downloadperl-9717af6d049902fc887c412facb2d15e785ef1a4.tar.gz
strftime: Set UTF-8 flag appropriately on return
The flag was only getting set if the format was in UTF-8. This looks at the return values, and sets the flag if they are non-ASCII UTF-8 and, as a further check, if the current locale is a UTF-8 one.
Diffstat (limited to 'lib/locale.t')
-rw-r--r--lib/locale.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/locale.t b/lib/locale.t
index d0adbd83f5..04ad46e3d5 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -1666,6 +1666,7 @@ foreach my $Locale (@Locale) {
my $ok17;
my $ok18;
my $ok19;
+ my $ok20;
my $c;
my $d;
@@ -1737,6 +1738,8 @@ foreach my $Locale (@Locale) {
}
$ok18 = $j eq sprintf("%g:%g", $h, $i);
$ok19 = POSIX::strftime("%p",@times) ne "%p"; # [perl #119425]
+ my $date = POSIX::strftime("%A %B %Z",@times);
+ $ok20 = $date =~ / ^ \p{ASCII}+ $ /x || ! utf8::is_utf8($date);
}
else {
use locale ':not_characters';
@@ -1816,6 +1819,8 @@ foreach my $Locale (@Locale) {
}
$ok18 = $j eq sprintf("%g:%g", $h, $i);
$ok19 = POSIX::strftime("%p",@times) ne "%p"; # [perl #119425]
+ my $date = POSIX::strftime("%A %B %Z",@times);
+ $ok20 = $date =~ / ^ \p{ASCII}+ $ /x || utf8::is_utf8($date);
}
report_result($Locale, ++$locales_test_number, $ok1);
@@ -1898,6 +1903,9 @@ foreach my $Locale (@Locale) {
report_result($Locale, ++$locales_test_number, $ok19);
$test_names{$locales_test_number} = 'Verify that strftime doesn\'t return "%p" in locales where %p is empty';
+ report_result($Locale, ++$locales_test_number, $ok20);
+ $test_names{$locales_test_number} = 'Verify that strftime returns date with UTF-8 flag appropriately set';
+
debug "# $first_f_test..$locales_test_number: \$f = $f, \$g = $g, back to locale = $Locale\n";
# Does taking lc separately differ from taking