[pypy-issue] [issue965] xml.etree.ElementTree says 'unknown encoding' of a regular encoding
Dongying Zhang
tracker at bugs.pypy.org
Fri Dec 16 10:15:16 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:
$ pypy test.py
Traceback message came out like this:
Traceback (most recent call last):
File "app_main.py", line 51, in run_toplevel
File "test.py", line 4, in <module>
xmlet.fromstring(s)
File "/usr/local/Cellar/pypy/1.7/lib-python/2.7/xml/etree/ElementTree.py", line
1282, in XML
parser.feed(text)
File "/usr/local/Cellar/pypy/1.7/lib-python/2.7/xml/etree/ElementTree.py", line
1624, in feed
self._raiseerror(v)
File "/usr/local/Cellar/pypy/1.7/lib-python/2.7/xml/etree/ElementTree.py", line
1488, in _raiseerror
raise err
ParseError: unknown encoding: line 1, column 30
Actually some versions of CPython have the same issue too.
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
I've created an issue here: http://bugs.python.org/issue13612
----------
files: test.py
messages: 3581
nosy: dongying, pypy-issue
priority: bug
release: 1.7
status: unread
title: xml.etree.ElementTree says 'unknown encoding' of a regular encoding
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue965>
________________________________________
More information about the pypy-issue
mailing list