Fix cert.csv utf-8

This commit is contained in:
VirtuBox
2020-10-14 18:17:06 +02:00
parent 256a07b4a5
commit c0547392e9
2 changed files with 7 additions and 28 deletions

View File

@@ -386,27 +386,3 @@ class WOFileUtils():
return True
else:
return False
def convertFileBestGuess(self, filename, filepath):
"""Convert file to utf-8"""
sourceFormats = ['ascii', 'iso-8859-1']
for format in sourceFormats:
try:
os.chdir(filepath)
with codecs.open(filename, 'rU', format) as sourceFile:
with codecs.open(
'tmp' + '/' + sourceFile, 'w', 'utf-8') as targetFile:
for line in sourceFile:
targetFile.write(line)
return
except UnicodeDecodeError:
pass
if os.path.exists("/tmp/{0}".format(filename)):
try:
self.rm(filepath + filename)
self.mvfile("/tmp/{0}".format(filename), filepath + filename)
except Exception as e:
Log.debug(self, "{0}".format(e))
Log.error(
self,
"Unable to move file : {0} ".format(filepath + filename))