title: UTF8 Python BOM
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/934160/write-to-utf-8-file-in-python">Write to utf-8 file in python</a>  </p>
  </blockquote>
  
  
  
  <p>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 <code>"ï»¿"</code> 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.</p>
  
  <pre><code>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()
  </code></pre>