bug fix (unicode(unicode) results in “TypeError: decoding Unicode is not supported” (http://www.red-mercury.com/blog/eclectic-tech/python-mystery-of-the-day/)

This commit is contained in:
Miroslav Stampar 2010-05-29 07:25:38 +00:00
parent d3e527aba3
commit a4155269c5

View File

@ -131,8 +131,7 @@ class XMLDump:
if attrValue is None :
attr.nodeValue = unicode("","utf-8")
else :
escaped_data = unicode(attrValue)
attr.nodeValue = unicode(escaped_data,"utf-8")
attr.nodeValue = attrValue if isinstance(attrValue, unicode) else unicode(attrValue,"utf-8")
return attr
def __formatString(self, string):