Re: UCS-2 in gunicode.h
- From: Havoc Pennington <hp redhat com>
- To: Derek Simkowiak <dereks kd-dev com>
- Cc: gtk-devel-list gnome org
- Subject: Re: UCS-2 in gunicode.h
- Date: 10 Jul 2000 16:14:17 -0400
Derek Simkowiak <dereks@kd-dev.com> writes:
> Sorry, my example was not clear. The g_print was incidental to
> the fact that the only thing *bytes_converted is good for is error
> checking.
>
> My question remains: g_convert() already does g_warnings followed by
> a returned NULL when the conversion fails:
>
> [...]
> g_warning ("Conversion from character set `%s' to `%s' is not supported",
> from_codeset, to_codeset);
> [...]
> g_warning("iconv() failed: %s", strerror (errno));
> [...]
>
I'm distinguishing these two error cases as "should not ever happen",
vs. the case where the text to be converted is invalid, which can
happen on non-broken systems.
Also, you might want to for example use the text that was converted
successfully, and discard the rest.
> (Playing the devil's advocate here, I thought "gchar" was supposed
> to be an abstract of the internal representation of a character? What if
> glib is ported to some Java-like O.S. where a "char" is 16 bits? And
> shouldn't we be using guint8* for UTF-8 input in the g_utf8_*()
> functions?)
>
No, gchar is simply the same as char, always 8 bits.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]