Unicode in writing to a file

Carbon Man darwin at nowhere.com
Thu Apr 23 14:07:54 CEST 2009


Py 2.5
Trying to write a string to a file.
self.dataUpdate.write(u"\nentry."+node.tagName+ u" = " + cValue)
cValue contains a unicode character. node.tagName is also a unicode string 
though it has no special characters in it.
Getting the error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in position 
22: ordinal not in range(128)

Thanks. 





More information about the Python-list mailing list