[ic] [interchange] Ensure that we use a UTF8 locale for strftime in [convert-date] tag.
Jon Jensen
jon at endpoint.com
Tue Mar 5 18:09:43 UTC 2013
Stefan,
What is your locale exactly?
Mine in $ENV{LANG} is "en_US.UTF-8", so it would not match your regex
check and would end up "en_US.UTF-8.utf8", if I'm reading this correctly.
Jon
On Tue, 5 Mar 2013, Stefan Hornburg wrote:
> 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 {
--
Jon Jensen
End Point Corporation
http://www.endpoint.com/
More information about the interchange-users
mailing list