I've created a file with the following code in lua:
local f = io.open("./data/myfile.html", "w")
f:write(text)
f:close()
String is stored in the file is Persian. When the file is opened letters are illegible. Like the screenshot below:
How I fix it?
Lua doesn't care about encoding. If your Lua source texts are already in utf-8, then you should just add "meta" tag in html "head" section.
<head>
<meta charset="UTF-8">
</head>
If your html version is earlier than html5, then use older construct:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.