Reputation: 45
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?
Upvotes: 1
Views: 1537
Reputation: 5847
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>
Upvotes: 2