cmder-powerline-prompt
cmder-powerline-prompt copied to clipboard
Fix Chinese garbled code
I use lua.io to get current path because I find Chinese path will appear garbled by using clink.getcwd()
Result:
Hi @trueLoving Traditional Chinese path still seems to be garbled
Can you show the original file path?
Traditional Chinese or Simplified Chinese, folder path cannot be displayed normally
After testing, still can't display correctly?
... It works well in my computer.
I guess it may be caused by external factors.My cmder version is 1.3.11
At present, I have only two suggestions to find out the cause of the garbled code
- You can enter the pwd command in the cmder to see if the current path is garbled
- You can add the code"print (cwd)" after line 58 of powerline_ prompt.lua file to show path , then save and rerun the cmder to see if the output is garbled
If the first explanation is caused by external reasons, I have no good suggestions at present. If the second description is the garbled code caused by Lua reading the path, this may be due to the lower version of the cmder. You can try to update the cmder
The most important to solve it is to find a solution to get current path.Maybe My solution is not so good.Now I'm looking for a better way to solve it.
Try to enter the pwd command in cmder to view the current path, the result is displayed normally
Add the code print(cwd) after line 58 of powerline_prompt.lua file, it will display garbled characters My cmder version is 1.3.14.982, and the latest released version is 1.3.15
I modified the vendor\init.bat file in the cmder directory and added the following code
@chcp 65001> nul
It can be displayed normally after the test, but the modification file (powerline_prompt.lua) you provide is still necessary Thank you very much!