Message149602
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 |
|
Date |
User |
Action |
Args |
2011-12-16 09:04:11 | dongying | set | recipients:
+ dongying |
2011-12-16 09:04:11 | dongying | set | messageid: <1324026251.51.0.0968835446575.issue13612@psf.upfronthosting.co.za> |
2011-12-16 09:04:10 | dongying | link | issue13612 messages |
2011-12-16 09:04:10 | dongying | create | |
|