azurIt wrote:
>
> I think it will be much cleaner to have Unicode = unicode and
> String = str. rpclib is beta anyway, backward incompatibility
> is/shoud be expected, so keep what is commited in your fork
> (but add a huge notice in changelog for other users). I will
> fix it on my side :) thank you!
>
> ______________________________________________________________
> > Od: "Burak Arslan" <[email protected]>
> > Komu: azurIt <[email protected]>
> > Dátum: 19.02.2012 20:41
> > Predmet: Re: [Soap-Python] rpclib and unicode strings
> >
> > CC: [email protected]
> >On 02/19/12 21:36, azurIt wrote:
> >> Looks fine so now i have to replace all 'String' types
> with 'Unicode'?
> >>
> >> azur
> >
> >with the current state of things, yeah. I could however
> switch back to
> >old way, where String = Unicode and real string is hidden as _String.
> >
> >what do you think? is it a huge backwards compatibility break ? or a
> >minor one?
> >
I don't follow all the implications of this thread, but I thought I should
mention that in python3, unicode and str are identical. If you pass 'bytes'
into etree.fromstring, you get bytes back. If you pass 'str' into
etree.fromstring, you get a (unicode) string back.
Here is your previous example run using python 3.2 -
This one uses bytes (note the 'b' at the front of the string) -
>>> a = etree.fromstring(b'<?xml version="1.0"
encoding="UTF-8"?><root><child>da
ta</child></root>')
>>> a[0].text
'data'
>>> a = etree.fromstring(b'<?xml version="1.0"
encoding="UTF-8"?><root><child>da
ta\u00e7</child></root>')
>>> a[0].text
'data\\u00e7'
This one uses unicode, so no 'encoding' is needed (it raises an error if you
try) -
>>> a = etree.fromstring('<?xml
version="1.0"?><root><child>data</child></root>')
>>> a[0].text
'data'
>>> a = etree.fromstring('<?xml
version="1.0"?><root><child>data\u00e7</child></
root>')
>>> a[0].text
'dataç'
>>>
I don't know if this is important, but I thought I should point it out.
Frank Millman
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap