actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
435 stars 94 forks source link

Is it possible to run lua files encoded in GB2312? #155

Open whc2001 opened 2 years ago

whc2001 commented 2 years ago

I have a lot of lua source files encoded in GB2312, and my OS locale is zh-CN (same with non-Unicode locale settings). I tried every setting combinations of "Console Coding" and "Source Coding" in plugin settings, but seems like the Chinese characters cannot be displayed correctly. If I save as UTF-8 then it works. Anyway to solve that since in the production environment I'll have to use GB2312?

image

actboy168 commented 2 years ago

lua-debug will not do any processing on the output of print. You can output to the terminal instead of the debug console to solve this problem.

            "console": "integratedTerminal",
            "outputCapture": [
            ],
whc2001 commented 2 years ago

I tried to put these to launch.json but seems like it still does not work. image

actboy168 commented 2 years ago

I can't reproduce.

whc2001 commented 2 years ago

Seems like the problem is that it's still using the built-in terminal rather than using cmd from Windows. I tried to run the script with lua5.1.exe from cmd and it prints correctly.

chigco commented 2 years ago

一样的问题,调试控制台中文乱码,设置了参数还是一样 文件编码:gb2312 "consoleCoding": "ansi", "sourceCoding": "ansi",

"Lua.runtime.version": "Lua 5.1", "files.encoding":"gb2312", "lua.debug.settings.consoleCoding": "ansi", "lua.debug.settings.sourceCoding": "ansi", "Lua.runtime.fileEncoding": "ansi", "lua.debug.settings.luaVersion": "5.1",

但是如果将文件编码改为utf8,print就能输出中文,(项目要求GB2312...)

chigco commented 2 years ago

调试过程中,变量页内容涉及到中文也全都显示乱码。