[rrd-developers] Bug#493553: rrdtool: broken with non-UTF8 locales: Invalid UTF-8 string passed to pango_layout_set_text()
Sebastian Harl
sh at tokkee.org
Mon Aug 4 16:17:18 CEST 2008
tags 493553 + patch pending
thanks
Hi,
On Sun, Aug 03, 2008 at 09:29:10AM +0300, Meelis Roos wrote:
> When invoking rrdtool graph in an environment with non-UTF8 locale (like
> my et_EE.ISO-8859-15) it still assumes the input is UTF-8. This results
> in messages like
> (process:8043): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()
> and broken diacritics in graph output.
>
> Might also be a problem with pango but it seems more likely that rrdtool
> is wrong here.
Well, imho, this is caused by some strange behavior of libpango. Anyway,
that behavior seems to be intended, so this is a bug in rrdtool. The
problem is, that pango_layout_set_text() and pango_layout_set_markup()
expect strings which are UTF-8 encoded (instead of using the encoding as
specified by the locale settings), so rrdtool has to make sure that this
is true.
The attached patch converts the given string to UTF-8 using glib's
g_locale_to_utf8() function. This function expects the string to be
encoded as specified by the locale settings, so this will fail if e.g.
you're using some script which is encoded in some way incompatible to
the locale settings. In this case, the patch falls back to use the
original string as provided by the user as there is no way to tell how
to interpret that string. So, in this case, you will still get the old
behavior (that pango warning and messed up strings in the graph).
However, imho this is perfectly fine since it should be up to the user
to take care of a sane environment.
I've just done some basic tests of that patch, so some more feedback
would be appreciated. Tobi, besides that, the patch should be fine for
inclusion in the next release of rrdtool.
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: 0001-rrd_gfx.c-Convert-strings-passed-to-pango_layout_se.patch
Type: text/x-diff
Size: 1739 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20080804/85d33dc7/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20080804/85d33dc7/attachment-0001.bin
More information about the rrd-developers
mailing list