Subject: | Plugin::Date and unicode flag |
[% date.format(date.now, '%A, %e %B %Y', locale => 'ru_RU.UTF-8') %]
->
ЧеÑвеÑг, 14 ÐаÑÑ 2013
because, posix module return not flagged string.
Patch fir fix this:
@@ -24,7 +24,7 @@
use warnings;
use base 'Template::Plugin';
use POSIX ();
-
+use Encode qw/_utf8_on/;
our $VERSION = 2.78;
our $FORMAT = '%H:%M:%S %d-%b-%Y'; # default strftime() format
our @LOCALE_SUFFIX = qw( .ISO8859-1 .ISO_8859-15 .US-ASCII .UTF-8 );
@@ -135,10 +135,16 @@
}
}
$datestr = &POSIX::strftime($format, @date);
+ if( $locale =~ /utf\-?8/i ){
+ _utf8_on( $datestr );
+ }
&POSIX::setlocale(&POSIX::LC_ALL, $old_locale);
}
else {
$datestr = &POSIX::strftime($format, @date);
+ if( &POSIX::setlocale(&POSIX::LC_ALL) =~ /utf\-?8/i ){
+ _utf8_on( $datestr );
+ }
}
return $datestr;