[New-bugs-announce] [issue13612] xml.etree.ElementTree says unknown encoding of a regular encoding
Dongying Zhang
report at bugs.python.org
Fri Dec 16 10:04:11 CET 2011
New submission from Dongying Zhang <zhangdongying1986 at gmail.com>:
I've been trying to parse xml string using python, codes following:
#-*- coding: utf-8 -*-
import xml.etree.ElementTree as xmlet
s = '<?xml version="1.0" encoding="GBK"?><info></info>'
xmlet.fromstring(s)
Then:
$ python2.6 test.py
or:
$ pypy test.py
Traceback message came out like this:
Traceback (most recent call last):
File "test.py", line 4, in <module>
xmlet.fromstring(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/etree/ElementTree.py", line 963, in XML
parser.feed(text)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/etree/ElementTree.py", line 1245, in feed
self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: unknown encoding: line 1, column 30
I've seen this in following cases:
Python2.5.6 on Mac OS X Lion
Python2.6.5 on Ubuntu 10.04
pypy1.7.0 on Mac OS X Lion
But not in these cases:
Python2.6.7 on Mac OS X Lion
Python2.7.1 on Mac OS X Lion
----------
components: Library (Lib)
files: test.py
messages: 149602
nosy: dongying
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree says unknown encoding of a regular encoding
versions: Python 2.6
Added file: http://bugs.python.org/file23974/test.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13612>
_______________________________________
More information about the New-bugs-announce
mailing list