Created
April 10, 2020 02:31
-
-
Save dqtweb/fd3d23e8d86043f06a733fe9a0cb9cbb to your computer and use it in GitHub Desktop.
Add UTF-8 support to csv content file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# so that you can open with excel | |
def addUTF8Bom(filename): | |
f = codecs.open(filename, 'r', 'utf-8') | |
content = f.read() | |
f.close() | |
f2 = codecs.open(filename, 'w', 'utf-8') | |
f2.write(u'\ufeff') | |
f2.write(content) | |
f2.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment