[issue1290] xml.dom.minidom not able to handle utf-8 data

Raghuram Devarakonda report at bugs.python.org
Thu Oct 18 22:43:20 CEST 2007


Raghuram Devarakonda added the comment:

When I run the code in a script, I don't get the error.

***************
marvin:cpython$ python
Python 2.5 (r25:51908, Jan 24 2007, 12:48:15) 
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.dom.minidom as dom
>>> data = open('testdata.txt','r').read()
>>> mydom = dom.parseString(data)
>>> mydom.firstChild.childNodes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022' in
position 18: ordinal not in range(128)
>>> import sys
>>> sys.getdefaultencoding()
'ascii'

marvin:cpython$ python dom.py 
marvin:cpython$ 
***************

Can you try and see if you can run it from the script too?

----------
nosy: +draghuram

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1290>
__________________________________


More information about the Python-bugs-list mailing list