Re: g_locale_from_utf8 and minus sign



On Mon, 29 Dec 2008, Bastien Nocera wrote:

> On Sun, 2008-12-28 at 16:17 -0500, Allin Cottrell wrote:
> > When my app displays numerical output, I've been using a "real"
> > minus sign (U+2212) if the current font supports this (as checked
> > by pango), since it looks better than the usual hyphen-as-minus.
> >
> > The minus sign displays correctly within GTK, but I've noticed
> > that if the app is running on, e.g. an ISO-8859-1 platform, so
> > that output has to be recoded for saving to disk or copying to the
> > clipboard, g_locale_from_utf8 chokes on the minus sign, giving
> >
> > "Invalid byte sequence in conversion input"
> >
> > I'm not sure if this is exactly a bug, but shouldn't U+2212 get
> > successfully mapped onto character 45 (0x002D) in ISO-8859-1?
>
> You should use g_filename_from_utf8() to convert to filenames.

I'm not converting to filenames, I'm converting text output.

> This is an application development question though, and you should use
> the gtk-app-devel-list.

I judged it a devel issue because it raised a question about
whether glib was doing the right thing in not converting U+2212 to
"the nearest" character in ISO-8859-1, 0x2D.  However, I accept an
offlist response from Dom Lachowicz, namely that these are
different characters and so glib is right not to convert.

Allin Cottrell


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]