03.11.2020, 11:03
Hi
I have made this script that is testing my installation and writing the result to a file and then sends it to my email. The only problem I still have is that the messages written to the report contains some Nordic characters, and that returns some ugly results like "PÃ¥drag ble ikke endret under varmetest".
Is there any way to set the character set to the file when writing to it?
Creating the file itself:
The code for adding a line to the table is:
Writing to file;
Is there anywhere in those where I can add the character set?
I have made this script that is testing my installation and writing the result to a file and then sends it to my email. The only problem I still have is that the messages written to the report contains some Nordic characters, and that returns some ugly results like "PÃ¥drag ble ikke endret under varmetest".
Is there any way to set the character set to the file when writing to it?
Creating the file itself:
Code:
errorFile = string.format('Feilmeldinger_%s.csv', os.date('%d-%m-%Y',log_start))
The code for adding a line to the table is:
Code:
table.insert(errorBuffer, addr.name .. '; Gikk ikke til 100% pådrag.')
Writing to file;
Code:
result, err = io.writefile ('/home/ftp/' .. errorFile, table.concat(errorBuffer, '\r\n'))
Is there anywhere in those where I can add the character set?
There are 10 kinds of people in the world; those who can read binary and those who don't