Re: glib utf8 api

> > 2) There seems to be no way to create a "best guess" valid
> > string.  g_utf8_validate is nice and all, but if validation 
> > fails I still need to create a valid string.  Am I supposed 
> > to use g_convert_with_fallback() from UTF-8 to UTF-8?
> Very good point.  I raised this here too:
> In Pango these days I loop over the string, calling
> g_utf8_validate()
> and replacing any invalid bytes with -1.  The -1 byte is known
> to be
> safe when passed to various glib UTF-8 functions.

As I dig deeper, it seems I also need this 
for non-utf8 strings.  For example, my input string is 
nominally SJIS, but contains a corrupt character in 
the middle.  g_convert stops at the corruption 
point.  I would like instead to recover the string 
(using substitution or deletion of corrupt characters) 
as I convert to utf8.

Maybe this is too much to ask, but I ask anyway.  :)


Greg Sharp
gregsharp geocities com

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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