Commit 65e825f6 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

[bug] Most of characters in pages are garbled with Perl 5.22.0 or later.

Users in non-Latin-1 languages (language other than "en", "de", "fr", ...) will notice this bug.

Background: Starting with Perl 5.22.0, POSIX::strftime() returns Unicode (utf8 flag set) string under UTF-8 locale.
- https://metacpan.org/pod/release/SHAY/perl-5.26.1/pod/perl5220delta.pod#Better-heuristics-on-older-platforms-for-determining-locale-UTF-8ness
- https://perl5.git.perl.org/perl.git/commit/9717af6d049902fc887c412facb2d15e785ef1a4

Sympa::Language::gettext_strftime() uses it to format localized date/time, and utf8-flagged texts were mixed in the output.

Fixed by dropping utf8 flag from the result of POSIX::strftime().
parent 55174639
......@@ -31,6 +31,7 @@ use strict;
use warnings;
use base qw(Class::Singleton);
use Encode qw();
use Locale::Messages;
use POSIX qw();
......@@ -688,6 +689,7 @@ sub gettext_strftime {
POSIX::setlocale(POSIX::LC_TIME(), $self->{locale_time});
}
my $ret = POSIX::strftime($format, @args);
Encode::_utf8_off($ret);
POSIX::setlocale(POSIX::LC_TIME(), $orig_locale);
return $ret;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment