Paul on Nostr: Google's odd text encoding fixed... using codecs... def TransformGoogle(infile): ...
Google's odd text encoding fixed... using codecs...
def TransformGoogle(infile):
bugdev(infile)
afile = codecs.open(infile, "r", encoding="utf-16LE")
NewFile="google/transform2ascii.csv"
bugdev (NewFile)
aTempFile = codecs.open(NewFile, "w", encoding="ascii", errors="ignore")
contentOfFile=afile.readlines()
for x in range(0, len(contentOfFile)):
aTempFile.write(contentOfFile[x])
afile.close()
aTempFile.close()
return NewFile
#Python
def TransformGoogle(infile):
bugdev(infile)
afile = codecs.open(infile, "r", encoding="utf-16LE")
NewFile="google/transform2ascii.csv"
bugdev (NewFile)
aTempFile = codecs.open(NewFile, "w", encoding="ascii", errors="ignore")
contentOfFile=afile.readlines()
for x in range(0, len(contentOfFile)):
aTempFile.write(contentOfFile[x])
afile.close()
aTempFile.close()
return NewFile
#Python