cmder-powerline-prompt icon indicating copy to clipboard operation
cmder-powerline-prompt copied to clipboard

Fix Chinese garbled code

Open trueLoving opened this issue 4 years ago • 7 comments

I use lua.io to get current path because I find Chinese path will appear garbled by using clink.getcwd()

Result:

捕获

trueLoving avatar Jun 27 '20 14:06 trueLoving

Hi @trueLoving Traditional Chinese path still seems to be garbled

11

jedchang avatar Jun 29 '20 02:06 jedchang

Can you show the original file path?

trueLoving avatar Jun 29 '20 04:06 trueLoving

Traditional Chinese or Simplified Chinese, folder path cannot be displayed normally 29_x_29_13-03-28

jedchang avatar Jun 29 '20 05:06 jedchang

After testing, still can't display correctly?

jedchang avatar Jun 30 '20 06:06 jedchang

... 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

  1. You can enter the pwd command in the cmder to see if the current path is garbled
  2. 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.

trueLoving avatar Jun 30 '20 06:06 trueLoving

Try to enter the pwd command in cmder to view the current path, the result is displayed normally 11

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

jedchang avatar Jun 30 '20 09:06 jedchang

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!

30_x_30_17-41-15

jedchang avatar Jun 30 '20 09:06 jedchang