WSL icon indicating copy to clipboard operation
WSL copied to clipboard

when locale != 437 (english-US) the change of font can't persist(Still have problem)

Open Po-wei opened this issue 9 years ago • 19 comments

  • Your Windows build number: (Type ver at a Windows Command Prompt) creator update Version 10.0.15063
  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots) if my locale set to 950 (Traditional Chinese),the change of the font (ex. consolas) on BashOnWindows or cmd would be reset to MingLiU. However, if the locale is set to 437, the font can be changed to consolas and it will not change when i reopen bash. The problem is when I use 437 as my codepage, many application which is build in Chinese or Chinese words in the terminal will crash because they cannot display the traditional Chinese words properly, and how can i resolve it?

image

image

p.s I just try the new freature of 256-color and that is just fantastic!

Po-wei avatar Apr 24 '17 18:04 Po-wei

@Po-wei - Hmm... codepage 950 or 437 is Windows locale. I guess... even though you set Windows to 437 codepage, linux is in zh_TW locale. Check your linux locale with "echo $LANG" command in linux. If you want to see english message, "export LC_ALL=C" command. Or, change your conlsole font in attribute - font of console window if you want to see chinese message.

sunjoong avatar Apr 24 '17 22:04 sunjoong

@miniksa for visibility. Probably related to #757

zadjii-msft avatar Apr 24 '17 23:04 zadjii-msft

Well, Maybe I didn't tell my problem very clear. When we set system locale to 437 just as #757 @slgray's and everything works fine with some Chinese character cannot display. If we can set set system locale to our local language and everything works as locale == 437, and that would be fantastic! Maybe I think a bug here?

The picture show ( locale == 950 && font == consolas) and you can see everything works fine with properly display Chinese character. However, the font settings cannot persist.

image

If locale is set to 437 and the font settings can persist but Chinese character cannot display if I set consolas as my default settings and the results are shown a day before.

btw. the dark blue are unreadable.........

Po-wei avatar Apr 25 '17 04:04 Po-wei

@Po-wei - You mean...

Case Windows Linux Font Result
1 950 (Chinese) zh_TW (Chinese) 細明體 Good
2 437 (English) zh_TW (Chinese) consolas Broken

You had changed font from consolas to 細明體 (MingLiU) in case 2 to see Chinese, but font was still consolas, not 細明體. Is this right? If so, it's a problem.

With consolas, if it cannot display 繁體中文 (Traditional Chinese), that's another problem.

sunjoong avatar Apr 25 '17 10:04 sunjoong

@sunjoong The table below may be clear. Because 細明體 are not monotype font, I would like to change my font to monotype font such as consolas. However, there are some problem list below...

Case system locale font display Chinese setting persist
1(default) 950(Chinese) 細明體 yes yes
2 950(Chinese) consolas yes no
3 437 (English) 細明體 yes yes
4 437 (English) consolas no yes
5 437 (English) other font no yes

I hope whether i can use Case 2 with persist settings or Case 4 or 5 with Chinese display on terminal! Hope that table could clarify my idea :)

Po-wei avatar Apr 25 '17 17:04 Po-wei

@Po-wei - Hmm... I had not understood the word presis.

So... you want to use consolas font in CP950. You set font to consolas but in vain; it turned back to 細明體 always. Hmm... UnCheck option - attribute - legacy console.

I tested and got a simular problem; I changed font setting but it went back. I saw legacy console check box was checked, so unchecked it; problem was solved. I tried to reproduce that problem again but failed; could not recheck legacy console. I can set and change font now with unchecked legacy console, i.e., new console.

sunjoong avatar Apr 25 '17 19:04 sunjoong

@sunjoong Do you access bash directly from bash.exe or access from cmd, from previous discussion, they say they have different settings. @zadjii-msft says: Bash is always lauched in 650001 which is UTF-8 and suprisely changing cp in cmd would lead to different result in bash.

bash property image cmd property image

And I think the box have been unchecked before... Bugs still exist ˊ_>ˋ

Po-wei avatar Apr 26 '17 07:04 Po-wei

@Po-wei - I use bash short cut in start menu, so not from cmd. I'm not sure the box had been unchecked initially. I meant... I had tested several times. When I began to test, I saw the problem too. And then, I tried to test with legacy/new console. I realized the problem was solved, but can't remember when; sorry. I could not reproduce the problem again and could not turn back to legacy console, so guessed the cause might be the legacy console. Hmm... I hope it would be solved in yours.

sunjoong avatar Apr 26 '17 08:04 sunjoong

@sunjoong Could you show me your solution more clearly? Do you test in cp 950? Which option you modify between legacy/new console? If there are some pictures to compare, that would be great! THX

Po-wei avatar Apr 26 '17 10:04 Po-wei

@Po-wei - These were my doings in my memory;

  1. Open bash in start menu
  2. Change font
  3. Exit from bash
  4. Open bash in start menu and see font is changed
  5. Check legacy console box
  6. Exit from bash
  7. Do 1 ~ 4
  8. Uncheck legacy console box
  9. Exit from bash
  10. Do 1 ~ 4

While doing, I did those with cmd (not bash from cmd, just cmd), but... there was no other option I used. I cannot use legacy console of bash now but can set font after that.

BTW, consolas could not display 為 character when I command "LANG=zh_TW.UTF-8 dpkg --help" but other fixed type font could do.

sunjoong avatar Apr 26 '17 15:04 sunjoong

@sunjoong I try this very times but in vain. too bad! Thanks for some idea~

Po-wei avatar Apr 30 '17 05:04 Po-wei

@Po-wei - Hmm... Then... try other console programs like ConEmu or wsl-terminal until finding a working solution. Good luck.

sunjoong avatar Apr 30 '17 10:04 sunjoong

@sunjoong I did not notice that you gave me another solution! XD Thanks for your help!

Po-wei avatar Apr 30 '17 13:04 Po-wei

@Po-wei , mind keep the issue open? I believe there is indeed a bug, despite a workaround being available.

There is a workaround referenced in issue #757 replies , which works for running bash.exe directly.

It still doesn't work if I start from the lnk

cxcxcxcx avatar Aug 13 '17 19:08 cxcxcxcx

You need a combined font that supports the charset CP950 likes 細明體 (It must declare support for CP950 in font meta information).

Just like me, my code page is 936 and I have been struggling with the issue for a long time. But I solved it today. I know that to solve the issue simply, I just need a font that supports the charset CP936 like SimSun. I tried some of combined fonts in Chinese and Western characters, but all didn't work. They have CP936 characters but they may not declare support for CP936 in font meta. So I cannot find them in CMD and PowerShell property. Only find in Bash property but not permanently.

But just now, I found "Microsoft YaHei Mono". I didn't need any extra action, just install it, and then select this font in the Bash property. Then the font will never change again.

The font = Microsoft YaHei + Consolas (Download: Microsoft YaHei Mono.zip)

You could find (or create with font combined tools) a font that combined Consolas and 細明體 and declared support for CP950 in its font meta. Then you can select the font in Bash property directly and permanently.

SwimmingTiger avatar Oct 06 '17 08:10 SwimmingTiger

I made a new font MicrosoftYaHeiMono-CP950.ttf that support both CP950 and CP936 which can really solve the problem for Chinese (Traditional) and Chinese (Simplified) users.

doggy8088 avatar Dec 06 '17 23:12 doggy8088

@doggy8088 This is AWESOME! Problem FINALLY SOLVED !

Po-wei avatar Dec 07 '17 10:12 Po-wei

I made a new font MicrosoftYaHeiMono-CP950.ttf that support both CP950 and CP936 which can really solve the problem for Chinese (Traditional) and Chinese (Simplified) users.

It solves my problem finally after all the struggles. Thank you very much.

XSBao avatar Apr 17 '19 17:04 XSBao

I think I just figured out how it could be addressed without installing new font.

Go to Control Panel - Clock, Language & Region - Locales - Region - Administrative - Language for non-Unicode programs - Change system locale, there you click on the Beta checkbox, after a reboot my WSL terminal finally got my font settings right! I tried tmux, vim, vim in tmux, etc., all functioned well.

My OS version is Windows 10 profesional, version 1809, 17763.529.


中文:前往 控制面板 - 时钟和区域 - 区域 - 管理 - 非Unicode程序的语言 - 更改系统区域设置,勾选“Beta版:使用Unicode UTF-8提供全球语言支持”,重启后WSL字体就不会再混乱了。测试过tmux,vim,tmux中使用vim,都没有出现字体回滚的问题。

#2463

zrdthu avatar May 26 '19 10:05 zrdthu