Re: UCS-2 in gunicode.h



-> I think we're just going to add a function like this to glib:
-> 
-> gchar*
-> g_convert (const gchar *str,
->            gint         len,
->            const gchar *to_codeset,
->            const gchar *from_codeset,
->            gint        *bytes_converted)

	Couple of minor questions:

1) What is the point of "*bytes_converted", other than to let the
programmer do

outbuf = g_convert(inbuf, strlen(inbuf), "UTF-8", "UCS-4", &bytes_converted);

if (bytes_converted != strlen(inbuf)) {
  /* Shouldn't this error-check be inside g_convert()? */
  g_print("The conversion was not successful.");
}

	What am I missing here?


2) Should it return gpointer instead of gchar *?  That would encourage the
application programmer to cast the output buffer to the correct data type,
i.e., gunicode, gunicode2, or whatever they're storing the output in.


--Derek





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