Possible Duplicate:
Write to utf-8 file in python
I have Unicode strings (with Japanese characters) I want to write to a CSV file.
However, the BOM does not seem to be written correctly, just as a string ""
in the first line. This leads to Excel not displaying the Japanese characters correctly. When opening the CSV with Notepad++, the characters are displayed correctly.
fileObj = codecs.open(filename,"w",'utf-8')
fileObj.write(codecs.BOM_UTF8)
c = u';'
for s in stringsToWrite:
line = e.someUnicodeString
fileObj.write(line)
fileObj.close()