How do I enforce a UTF8 encoding on a generated CSV report in web2py?
How do I enforce a UTF8 encoding on a generated CSV report?
str.encode function together with the csv module, there is a complete example that will show you that in the Python documentation (or in the link given in comment to your question). Quick example:
row = ["one", "two", "three"] import csv with open("report.csv", "wb") as f: writer = csv.writer(f) writer.writerow([s.encode("utf-8") for s in row])