[rrd-developers] UTF-8 and pango ... again
Sebastian Harl
sh at tokkee.org
Tue Jul 21 09:24:40 CEST 2009
Hi,
The following problem has been reported to me:
When creating graphs covering one year and using something like
LANG=en_US.UTF-8 and LC_TIME="de_DE" in the environment, pango reports
the following warning:
Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()
The graph uses the months as x-axis labels, which includes the string
"MÀrz" ("March" in German). The umlaut ('À') ends up being messed up in
the generated graph.
I suppose that the problem is the following:
rrd_graph.c uses strftime() to format the time which uses LC_TIME to
determine the locale settings. Thus, in this case, the formatted date
probably ends up not being encoded in UTF-8.
The string is then passed to gfx_prep_text() (via gfx_text()) which uses
g_locale_to_utf8() to convert the string from the local encoding to
UTF-8 (which is required by pango). Now, g_locale_to_utf8() probably
determines the locale settings from LANG and thus decides, in this case,
that nothing needs to be done.
I currently don't have any ideas how to properly solve that. One could
argue that the locale settings are messed up and that it's the users own
damn fault. However, I've never seen similar problems in other pieces of
software, so there ought to be some way to solve that.
Well, RRDtool could parse all relevant LC_* environment variables and
then handle the situation appropriately. That'd probably be a whole lot
of ugly work though, so it would be nice if somebody could think of a
better solution. Changing the locale setting inside RRDtool does not
sound like a valid solution either, since, then, strings passed on the
command line would no longer be handled appropriately.
Any ideas?
Cheers,
Sebastian
--
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090721/51fc81cf/attachment.bin
More information about the rrd-developers
mailing list