Re: xml.parsers.expat and utf-8

2005-05-03 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > I have this code: > > import xml.parsers.expat > parser = xml.parsers.expat.ParserCreate(encoding="UTF-8") > text = unicode("þórður",'UTF-8') I think you want text = u"þórður".encode('UTF-8') so text is a UTF-8 string. Kent -- http://mail.python.org/mailman/listinf

Re: xml.parsers.expat and utf-8

2005-05-03 Thread "Martin v. Löwis"
[EMAIL PROTECTED] wrote: > I think I've tried all variations possible but I always get errors. > Anyone know what I'm doing wrong? You are passing Unicode strings to Parse. Try byte strings instead. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

xml.parsers.expat and utf-8

2005-05-03 Thread dagurp
I have this code: import xml.parsers.expat parser = xml.parsers.expat.ParserCreate(encoding="UTF-8") text = unicode("þórður",'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