Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

This works in 3.x:

Python 3.2rc2+ (py3k:88279:88280, Feb  1 2011, 00:01:52)
..
>>> from xml.etree import ElementTree
>>> ElementTree.fromstring('<doc>诗</doc>')
<Element 'doc' at 0x1007daa00>

In 2.x you need to encode unicode strings before passing them to 
ElementTree.fromstring().  For example:

----
# encoding: utf-8                                                               
                                                                                
       
from xml.etree import ElementTree
t = ElementTree.fromstring(u'<doc>诗</doc>'.encode('utf-8'))
print t.text
----

This is not a bug because fromstring() unlike some other ElementTree methods is 
not documented to support unicode strings. Since 2.x is closed for new 
features, this has to be rejected.

----------
assignee:  -> belopolsky
nosy: +belopolsky
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> pending
type: crash -> feature request
versions: +Python 2.7 -Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to