When creating a DOC or Excel file using the LUA language, Russian characters are not displayed correctly

时间秒杀一切 提交于 2019-12-24 07:59:05

问题


My code works, but instead of Russian characters incomprehensible characters are displayed. My code:

local fileName = "myfile3.doc" 
local FileWrite 
FileWrite = io.open(fileName, "w") 
FileWrite:write("фывф", '\n') 
FileWrite:close()

or

require('luacom') 
excel = luacom.CreateObject("Excel.Application") 
excel.Visible = true 
wb = excel.Workbooks:Add() 
ws = wb.Worksheets(1) 
for i=1, 10 do 
ws.Cells(i,1).Value2 = "фывф" 
end

回答1:


It works for me exactly as written. I used UTF-8 encoding for the file (CP65001 on Win8). Here is the snapshot of the result:



来源:https://stackoverflow.com/questions/58013508/when-creating-a-doc-or-excel-file-using-the-lua-language-russian-characters-are

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!