[interchange] Ensure that we use a UTF8 locale for strftime in [convert-date] tag.
Stefan Hornburg
interchange-cvs at icdevgroup.org
Tue Mar 5 17:45:28 UTC 2013
commit 8fd6ad78ee18174b556d953ca9ab52606b449acc
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Mon Mar 4 10:48:54 2013 +0100
Ensure that we use a UTF8 locale for strftime in [convert-date] tag.
Otherwise it causes a crash with "Malformed UTF-8 character".
code/UserTag/convert_date.tag | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/code/UserTag/convert_date.tag b/code/UserTag/convert_date.tag
index e91b908..4718f81 100644
--- a/code/UserTag/convert_date.tag
+++ b/code/UserTag/convert_date.tag
@@ -76,7 +76,13 @@ sub {
my $locale = $opt->{locale} || $Scratch->{mv_locale};
if ($locale) {
$current = POSIX::setlocale(&POSIX::LC_TIME);
- POSIX::setlocale(&POSIX::LC_TIME, $locale);
+ if (($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8})
+ && $locale !~ /\.utf8$/) {
+ POSIX::setlocale(&POSIX::LC_TIME, "$locale.utf8");
+ }
+ else {
+ POSIX::setlocale(&POSIX::LC_TIME, $locale);
+ }
$out = POSIX::strftime($fmt, @t);
POSIX::setlocale(&POSIX::LC_TIME, $current);
} else {
More information about the interchange-cvs
mailing list