This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Writing to file, UTF-8
#1
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:
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  Cool
Reply


Messages In This Thread
Writing to file, UTF-8 - by Trond Hoyem - 03.11.2020, 11:03
RE: Writing to file, UTF-8 - by admin - 03.11.2020, 11:05
RE: Writing to file, UTF-8 - by Trond Hoyem - 03.11.2020, 11:13

Forum Jump: