Skip to content Skip to sidebar Skip to footer

Unicode Encoding Errors Python - Parsing Xml Can't Encode A Character (star)

I am a beginner to Python and am currently parsing a web-based XML file from the eventful.com API however, I am receiving some unicode errors when retrieving certain elements of th

Solution 1:

Where are you using your decoding methods?

I had this error in the past and had to decode the raw. In other words, I would try doing

data = response.read()
#closes file
response.close()
#decode
data.encode("us-ascii")

That is if it is in fact ascii. My point being make sure you are encoding/decoding the raw results while it is still in a string format, before you call parseString on it.

Post a Comment for "Unicode Encoding Errors Python - Parsing Xml Can't Encode A Character (star)"