Re: UCS-2 in gunicode.h



Derek Simkowiak <dereks@kd-dev.com> writes: 
> 	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?
>

g_print() is probably not the right thing to do on error, the
application needs to handle this error, likely by presenting a dialog.
 
> 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.
> 

Usually people just treat all encodings as gchar*, this seems to be
the libc standard.

Havoc




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