By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

xml.parsers.expat and utf-8

P: n/a
I have this code:

import xml.parsers.expat
parser = xml.parsers.expat.ParserCreate(encoding="UTF-8")
text = unicode("<div>rur</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?

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.