> + return unicode(item, 'utf-8')
NAK, must still kill some valid unicode.
b: _ugly_utf8_string_hack('\x07') => ''
a: _ugly_utf8_string_hack('\x07') => u'\x07'
>>> from xml.etree import cElementTree as ET
>>> blah=ET.Element('blah')
>>> blah.text = u'\x07'
>>> ET.tostring(blah, encoding='utf8')
"<?xml version='1.0' encoding='utf8'?>\n<blah>\x07</blah>"
>>> ET.fromstring(_)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 106, in XML
cElementTree.ParseError: not well-formed (invalid token): line 2, column 6
But for unicode input, things haven't changed.
We mostly feed UTF8 to to_xml(), probably.
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel