Behaviour of g_utf8_to_utf16



Hi,

As far as I can tell by experimentation, g_utf8_to_utf16 always stops
at the first nul in a string, even when a positive value is passed for
the len argument. If I have a UTF8 string with embedded nuls (of known
length, of course), is there a good way to convert it to UTF16 with
GLib? I thought at first that passing a positive len would have this
effect because I read "If len < 0, then the string is nul-terminated"
to mean that if len > 0 then the string may have nuls without
terminating, but on observing the behaviour I think this must mean
only that the string is allowed not to have any nul at all.

http://developer.gnome.org/glib/2.31/glib-Unicode-Manipulation.html#g-utf8-to-utf16

Regards,

Weeble.


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