Created
July 22, 2019 11:55
-
-
Save dvictori/c277aa12d0f7f1bcc5b0c061227f1442 to your computer and use it in GitHub Desktop.
Get rid of bogus characters in UTF-8 encoding file
This file contains 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
#!/usr/bin/env python3 | |
import io | |
import os, sys | |
os.rename(sys.argv[1],'tempfile.sql') | |
saida = open(sys.argv[1], "w") | |
with io.open("tempfile.sql", encoding="utf-8", errors='ignore') as f: | |
for line in f: | |
saida.write(line) | |
saida.close() | |
os.remove("tempfile.sql") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment