EDIT:
As suggested special chars are displayed correctly if I use notepad++ to open the csv file. They are displayed correctly too when I import the csv file into excel. How can I generate a csv file that is displayed correctly when opened by excel since file importing is not an option for the users
I'm generating a csv file that is being processed using Excel.
Special caracters like 'é' are not displayed properly when the file is opened with excel
This the poc I'm using to generate the csv file
# -*- coding: utf-8 -*-
import unicodecsv as csv
import codecs
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def write_csv(file,headers):
resultFile =codecs.open(file, "w+", "utf-8")
#headers=[s.encode('utf-8') for s in headers]
wr = csv.writer(resultFile, dialect='excel',delimiter=";",encoding="utf-8")
wr.writerow(headers)
resultFile.close()
headers=[""]
headers.append("Command")
headers.append("Vérification".encode('utf-8'))
write_csv(r"C:\test2.csv",headers)