xml.parsers.expat and utf-8
dagurp at gmail.com
dagurp at gmail.com
Tue May 3 11:59:28 EDT 2005
I have this code:
import xml.parsers.expat
parser = xml.parsers.expat.ParserCreate(encoding="UTF-8")
text = unicode("<div>þórður</div>",'UTF-8')
print parser.Parse(text,1)
And this is what I get:
UnicodeEncodeError: 'ascii' codec can't encode characters in position
5-6: ordinal not in range(128)
I think I've tried all variations possible but I always get errors.
Anyone know what I'm doing wrong?
More information about the Python-list
mailing list