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

Ralph Meijer twisted at ralphm.ik.nu
Wed Feb 18 08:51:05 EST 2009


On 2009-02-18 12:14, Gabriel Rossetti wrote:
> Hello,
> 
> I wrote some code to transform a raw XML string into a domish.Element, 
> and I keep on getting char encoding/decoding errors :
> 
> [..]
>            parser.parse(tmp.toXml())
 > [..]

Parser input is expected to be a string, not unicode. Try this instead:

   parser.parse(tmp.toXml().encode('utf-8'))

ralphm




More information about the Twisted-Python mailing list