Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a415526

Browse files
committed
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/)
1 parent d3e527a commit a415526

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/core/xmldump.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ def __createAttribute(self,attrName,attrValue):
131131
if attrValue is None :
132132
attr.nodeValue = unicode("","utf-8")
133133
else :
134-
escaped_data = unicode(attrValue)
135-
attr.nodeValue = unicode(escaped_data,"utf-8")
134+
attr.nodeValue = attrValue if isinstance(attrValue, unicode) else unicode(attrValue,"utf-8")
136135
return attr
137136

138137
def __formatString(self, string):

0 commit comments

Comments
 (0)