[pygtk] utf8 validating string

Yann Leboulanger asterix at lagaule.org
Tue Dec 4 06:17:13 WST 2007


John Ehresman wrote:
> Yann Leboulanger wrote:
>> John Ehresman wrote:
>>> I'm confused here; I think your last example passes '\x0' to a gtk
>>> function which does not work.  Either remove the '\x0' or do something
>>> else with \x0 here.  Or am I missing something?
>>>
>>
>> removeing the \x0 isn't a problem, a replce can do that, but is it the
>> only char that will cause this problem?
> 
> Yes as long as the rest is valid utf8.  \x0 is a problem because it
> terminates C strings so you can never have a C string with a \x0 in it
> (it's not quite that simple, but if you don't know C it's probably close
> enough).  Python strings can contain \x0 so there's a problem when
> passing the length to the conversion function.
> 
> Cheers,
> 
> John
> 

ok great, thanks, python's greater than C ;)
Ok ok I go out ->[] ;)
-- 
Yann


More information about the pygtk mailing list