On 10/25/11 14:15, azurIt wrote:
> Hi,
>
> i'm having problems when returning non-unicode strings which contains unicode 
> characters (i have strings in utf-8 but they are not python unicode):
>
> ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL 
> bytes or control characters
>
> Everything works fine when i convert strings to unicode but i cannot do this 
> with all strings, i don't consider nice and clear to convert all strings just 
> before returning them (i have most of them from MySQL returned by module 
> python-mysql). Is there any way how could rpclib convert this for me before 
> lxml parsing ? Everything is in UTF-8 so it shouldn't be a problem. Thank you.
>

utf8 is just one way of encoding unicode data, and i don't want to have
hard-coded encodings in rpclib. when I had to deal with a similar
problem recently, I chose to tweak my db connection (psycopg) to always
return unicode data. i now have peace of mind :) i suggest you to do the
same.

this of course may not suit your needs. there's a hidden _String type in
rpclib.model.primitive in my personal fork. does it work for you? you
can set its encoding to whatever you want using
_String(encoding='whatever').

I can't decide whether it should be left as String or moved to binary
module and renamed to Bytes.

does that help?

burak

_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to