Re: Troubles handling ustring and charsets.



Am Freitag, den 05.01.2007, 00:36 +0100 schrieb Fernando Tar�
> Hi I'm using Glib::ustring as a string container to handle utf8 but
> I'm having some troubles. When I try to print a ustring with utf8
> chars like "�or  "�o stdout i always get this exception(with
> ascii chars it works well): 
>        terminate called after throwing an instance of
> 'Glib::ConvertError' 
> with this error:
>        Invalid byte sequence in conversion input
> 
> When i call Glib::get_charset(charset) the function always returns
> ANSI_X3.4-1968 as the charset may be this is the reason that
> conversion fails even when I use Glib::locale_from_utf8()?? 

Indeed.  Plain old ASCII is a 7-bit code, that is it only defines code
positions up to 127.

> I have tried with different charsets ( ISO-8859-15 and UTF8) specified
> with locale (locale charmap to get the charset which is being used)
> but 
> Glib::get_charset(charset) always returns ANSI_X3.4-196 as charset and
> i can't print it even using Glib::locale_from_utf8()  function. 
> Any clue to solve this.

This is most likely a problem with your locale setup.  What's the output
of "locale"?  You might have to install additional packages from your
distribution, or reconfigure the glibc locales package to include more
locales.

--Daniel





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