[issue2278] [Py30a3] xml.parsers.expat recognizes encoding="utf-8" but not encoding="utf8"
Mark Summerfield
report at bugs.python.org
Wed Mar 12 12:04:03 CET 2008
New submission from Mark Summerfield <mark at qtrac.eu>:
Here is how to reproduce the bug:
from xml.etree.ElementTree import parse
import io
xml1 = """<?xml version="1.0" encoding="utf8"?>
<test>text</test>"""
xml2 = """<?xml version="1.0" encoding="utf-8"?>
<test>text</test>"""
f1 = io.StringIO(xml1)
f2 = io.StringIO(xml2)
tree2 = parse(f2) # this uses "utf-8" and works fine
tree1 = parse(f1)
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
tree1 = parse(f1)
File
"/home/mark/opt/python30a3/lib/python3.0/xml/etree/ElementTree.py", line
823, in parse
tree.parse(source, parser)
File
"/home/mark/opt/python30a3/lib/python3.0/xml/etree/ElementTree.py", line
561, in parse
parser.feed(data)
File
"/home/mark/opt/python30a3/lib/python3.0/xml/etree/ElementTree.py", line
1201, in feed
self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: unknown encoding: line 1, column 30
----------
messages: 63471
nosy: mark
severity: normal
status: open
title: [Py30a3] xml.parsers.expat recognizes encoding="utf-8" but not encoding="utf8"
versions: Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2278>
__________________________________
More information about the Python-bugs-list
mailing list