in claralogConverter.py, use Latin-1 encoding to be tolerant against noisy log files

This commit is contained in:
uhi22 2024-05-09 22:41:31 +02:00
parent 701ab1b492
commit 4274e8b8a1

View file

@ -47,11 +47,11 @@ def convertClaralogToTxt(inputFileName):
if (os.path.isfile(os.path.join(directory, outputFileName))): if (os.path.isfile(os.path.join(directory, outputFileName))):
print("output file " + outputFileName + " already exists. Nothing to do.") print("output file " + outputFileName + " already exists. Nothing to do.")
return return
fileIn = open(inputFileName, 'r') fileIn = open(inputFileName, 'r', encoding="Latin-1")
fileOut = open(outputFileName, 'w') fileOut = open(outputFileName, 'w', encoding="Latin-1")
print("# generated by claralogConverter.py", file=fileOut) print("# generated by claralogConverter.py", file=fileOut)
print("# https://github.com/uhi22/pyPLC", file=fileOut) print("# https://github.com/uhi22/pyPLC", file=fileOut)
fileOutValues = open(inputFileName + '.values.txt', 'w') fileOutValues = open(inputFileName + '.values.txt', 'w', encoding="Latin-1")
print("# generated by claralogConverter.py", file=fileOutValues) print("# generated by claralogConverter.py", file=fileOutValues)
print("# https://github.com/uhi22/pyPLC", file=fileOutValues) print("# https://github.com/uhi22/pyPLC", file=fileOutValues)
fileOutStatistics = open(directory + '/pcap_statistics.txt', 'a') fileOutStatistics = open(directory + '/pcap_statistics.txt', 'a')