Re: Need help on international chars



On Sat, 2003-05-31 at 11:14, Ross McFarland wrote:
in a related note. a quick and dirty pass through the Gtk2/xs code for
discrepancies between gchar and char (like the one you just fixed)
didn't turn up much. but in PangoLayout.xs the set_text and get_text
functions don't match the function prototypes, the on-line
documentation, or the header files. all of the above say [const] char *
xxx and the xs code has [const] gchar * xxx. don't know if this is on
purpose, but it probably deserves a look by someone who would/does.

from what i could tell, whereas glib and gtk religiously use gchar*
because any text can be utf8, pango is not so attentive, although from
what i could tell the text could be utf8.

the distinction of char* is ascii and gchar* is utf8 is purely
convention on the part of the bindings; it doesn't seem to be observed
by everyone (much like using const on returned strings to show that they
needn't be freed -- would be nice if everybody did it, but only a few
do).

so, it looked like it would be a good move to use gchar on the pango
stuff, even though they didn't.  anyone who knows better, please let us
know.



for reference (for anyone willing to fix it):

(const )?gchar* will use the T_GCHAR typemap, which does the same work
as SvGChar(), basically, ensuring that the string is treated as utf8. 
hand-coded SV manipulation should use newSVGChar and SvGChar to handle
these.

(const )?(unsigned |gu)?char* will simply use the T_PV typemap, which
does NOT ensure utf8, but does not strip it, either.  use the standard
SvPV, SvPV_nolen, and newSVpv to manipulate these outside of typemaps.



-- 
muppet <scott at asofyet dot org>




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