Re: [Tutor] Encoding and XML troubles

2006-11-08 Thread Danny Yoo
Vanilla (this works fine): #!/usr/bin/python from elementtree import ElementTree as etree eg = """redblue""" xml = etree.fromstring(eg) If I change the example string to this: redblu� I get the following error: xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 32)

Re: [Tutor] Encoding and XML troubles

2006-11-08 Thread William O'Higgins Witteman
Thanks for the help thusfar. To recap - when parsing XML, ElementTree is barfing on extended characters. 1. Yes, most XML is written by monkeys, or the programs written by such monkeys - tough beans, I cannot make my input XML any cleaner without pre-processing - I am not generating it. 2. The d

Re: [Tutor] Encoding and XML troubles

2006-11-05 Thread Dustin J. Mitchell
For what it's worth, the vast majority of the XML out there (especially if you're parsing RSS feeds, etc.) is written by monkeys and is totally ill-formed. It seems the days of 'it looked OK in my browser' are still here. To find out if it's your app or the XML, you could try running the XML thro

Re: [Tutor] Encoding and XML troubles

2006-11-05 Thread Kent Johnson
William O'Higgins Witteman wrote: > 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 impo

Re: [Tutor] Encoding and XML troubles

2006-11-04 Thread Luke Paireepinart
Inputting XML into a Python program has nothing to do with what encoding the python source is in.So it seems to me that that particular PEP doesn't apply in this case at all.I'm guessing that the ElementTree module has an option to use Unicode input. ___

[Tutor] Encoding and XML troubles

2006-11-04 Thread William O'Higgins Witteman
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