[Tutor] Encoding and XML troubles
William O'Higgins Witteman
hmm at woolgathering.cx
Sat Nov 4 22:04:29 CET 2006
I've been struggling with encodings in my XML input to Python programs.
Here's the situation - my program has no declared encoding, so it
defaults to ASCII. It's written in Unicode, but apparently that isn't
confusing to the parser. Fine by me. I import some XML, probably
encoded in the Windows character set (I don't remember what that's
called now). I can read it for the most part - but it throws exceptions
when it hits accented characters (some data is being input by French
speakers). I am using ElementTree for my XML parsing
What I'm trying to do is figure out what I need to do to get my program
to not barf when it hits an accented character. I've tried adding an
encoding line as suggested here:
http://www.python.org/dev/peps/pep-0263/
What these do is make the program fail to parse the XML at all. Has
anyone encountered this? Suggestions? Thanks.
--
yours,
William
More information about the Tutor
mailing list