[rrd-developers] Bug#493553: rrdtool: broken with non-UTF8 locales: Invalid UTF-8 string passed to pango_layout_set_text()

Tobias Oetiker tobi at oetiker.ch
Mon Aug 4 22:36:15 CEST 2008

Hi Sebastian,

cool ... thanks ... I have included

Today Sebastian Harl wrote:

> 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

Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900

More information about the rrd-developers mailing list