[mythtv-users] MythWeather/Perl locale UTF-8/ISO-8859-1 problems ?

Rune Evjen rune.evjen at gmail.com
Sun Sep 26 20:03:13 UTC 2010


When using the Norwegian yr.no weather data provider in current trunk,
I get what seems to be some UTF-8/ISO-8859-1 encoding problems for
Norwegian æøå letters.

It seems that the function 'format_date' in
'/usr/share/mythtv/mythweather/scripts/no_yrno/yrnoxml.pl' returns
no-UTF8 character, even if the locale is/should be correctly set.

The small perl test:

use POSIX qw(strftime);
print strftime "%a %b %e %H:%M:%S %Y", localtime;

works fine, and gives a UTF-8 display of the date: sø. sep. 26 21:53:30 2010.

But in mythtv and when running the yrnoxml.pl script the date is shown
like this:

..
date-0::ma. sep. 27, 2010 12:00:00
date-1::ti. sep. 28, 2010 12:00:00
date-2::on. sep. 29, 2010 14:00:00
date-3::to. sep. 30, 2010 14:00:00
date-4::fr. okt.  1, 2010 14:00:00
date-5::lø. okt.  2, 2010 14:00:00
..
observation_time::sø. sep. 26, 2010 19:15:00
...
Based on my very limited perl understanding the above output is
created using the 'format_date' function, which uses strftime to
convert the raw data to the date format in the script output, in more
or less the same way as my test script which has a correct output.

If I convert the output from yrnoxml.pl from ISO-8859-1 to UTF-8 using
iconv -f ISO-8859-1 -t UTF-8 <yrnoxml-output> the norwegian letters
are displayed fine.

My user locale is set to:
rune at server:~$ locale
LANG=nb_NO.utf8
LANGUAGE=nb:nb_NO:en_US:en
LC_CTYPE="nb_NO.utf8"
LC_NUMERIC="nb_NO.utf8"
LC_TIME="nb_NO.utf8"
LC_COLLATE="nb_NO.utf8"
LC_MONETARY="nb_NO.utf8"
LC_MESSAGES="nb_NO.utf8"
LC_PAPER="nb_NO.utf8"
LC_NAME="nb_NO.utf8"
LC_ADDRESS="nb_NO.utf8"
LC_TELEPHONE="nb_NO.utf8"
LC_MEASUREMENT="nb_NO.utf8"
LC_IDENTIFICATION="nb_NO.utf8"
LC_ALL=

Has anyone seen this before ? Is this a locale configuration issue ?

Best regards,

Rune


More information about the mythtv-users mailing list