[Twisted-Python] raw xml to element, char encoding/decoding error

Gabriel Rossetti gabriel.rossetti at arimaz.com
Wed Feb 18 07:26:09 MST 2009


Ralph Meijer wrote:
> On 2009-02-18 14:57, Gabriel Rossetti wrote:
>> Ralph Meijer wrote:
>>> On 2009-02-18 12:14, Gabriel Rossetti wrote:
>>> [..]
> >>
>>> Parser input is expected to be a string, not unicode. Try this instead:
>>>
>>>   parser.parse(tmp.toXml().encode('utf-8'))
>>>
>>> ralphm
>>>
>> Hello Ralphm,
>>
>> yes, I had fixed that in the code attached in my last msg, it only 
>> works in Eclipse though.
>
> Ah, but in /that/ code, you typed:
>
>     res = rawXmlToElement("<t>reçu</t>")
>
> While you should have:
>
>     res = rawXmlToElement(u"<t>reçu</t>")
>
> ralphm
>
Ahh, yes, I see my error, thanks :-) I'm glad everything is unicode in 
python 3....

Gabriel




More information about the Twisted-Python mailing list