[New-bugs-announce] [issue11033] ElementTree.fromstring doesn't work with Unicode
Peter Cai
report at bugs.python.org
Fri Jan 28 01:07:36 CET 2011
New submission from Peter Cai <newptcai at gmail.com>:
xml.etree.ElementTree.fromstring doesn't work with Unicode string. See the code below:
>>> from xml.etree import ElementTree
>>> t = ElementTree.fromstring(u'<doc>诗</doc>')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python26\lib\xml\etree\ElementTree.py", line 963, in XML
parser.feed(text)
File "D:\Python26\lib\xml\etree\ElementTree.py", line 1245, in feed
self._parser.Parse(data, 0)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u8bd7' in position 5
: ordinal not in range(128)
----------
components: XML
messages: 127239
nosy: Peter.Cai
priority: normal
severity: normal
status: open
title: ElementTree.fromstring doesn't work with Unicode
type: crash
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11033>
_______________________________________
More information about the New-bugs-announce
mailing list