UTF8 characters in windows 10 bash terminal

37,138

Solution 1

To add to Doctorj's answer, there are a couple fonts that are installed by default that you can use (on Windows 10 bash shell).

Tested languages: Bulgarian, Ukrainian, Chinese Simplified, Chinese traditional, Danish, French, German, Italian, Japanese, Kazakh, Korean, Macedonian, Mongolian, Norwegian, Polish, Portuguese, Russian, Serbian, Spanish, Swedish.

The following default fonts display all observed characters:

  • MS Gothic
  • NSimSun
    • Doesn't appear to display all of Kazakh.
  • SimSun-ExtB (raster font) - My recommendation

Both MS Gothic and NSimSun

  • Spaces out non-Latin non-CJK (Chinese, Japanese, Korean) languages (Macedonian, Kazakh, Bulgarian).
  • Has an odd vertical offset on accented Latin characters (á,é).
  • Didn't display at least one Macedonian character.

SumSun-ExtB (raster font):

  • There's a warning message saying that Raster fonts may not display well.
  • Most characters are displayed darkly (could be a problem with low screen brightness).
  • Non-ASCII characters are bright, in comparison to ASCII characters (possible solution, use the bold option).
  • Characters of all languages close together (easier to see spacing between words).
  • Seems more reliable for non-Latin non-CJK languages.

With any of these fonts, both Command Prompt and PowerShell, weird things happen when you click on non-ASCII characters, though it goes back to normal when you highlight the text.

To install a font: Note that you need to change the font for the Windows shell you're using, such as the Command Prompt or PowerShell, not the Linux way through bash. This link describes which fonts can be used on the Command Prompt (monospace fonts, and how to install and select a font for Command Prompt): Add fonts to the Command Prompt

  • Bring up Registry Editor (run "regedit")
  • Find the folder HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
  • Right click (or Edit) -> New -> String Value
  • Name the font with one more 0 than the last one (such as "000").
  • Right click the entry and select "Modify..."
  • Enter the name of the font or OTF file (without .otf).

For information on installing fonts through the command line on Windows, see this question and answers.

  • I tried installing "Source Code Pro" but it didn't appear in the fonts for me.
  • I installed DejaVu Sans Mono and it works for most languages but doesn't work at all for CJK.
  • I installed Google's Noto monospace font, and it worked, but not for CJK. Also, they specifically say they don't have monospace support for CJK.
  • I installed Google's Inconsolata, and it wasn't worth the try.
  • I installed GNU FreeFont (FreeMono), and it worked, but not for CJK.
  • I gave up and went back to SimSun-ExtB.

(Note: I don't have enough reputation yet to post the links).

Solution 2

Right click on the title bar at top of the bash window, choose the entry properties. In the opening window is a tab where you can change the font. I changed the Font to "Source Code Pro" and size 14.

Looks good and all utf-8 characters are working.

Solution 3

You can try DejaVu Sans Mono - it works for me.

Share:
37,138

Related videos on Youtube

Ortix92
Author by

Ortix92

Updated on September 18, 2022

Comments

  • Ortix92
    Ortix92 over 1 year

    I have installed the new bash shell on windows 10. I'm using it together with ZSH. However, none of the utf8 characters work, they appear as square blocks. How do I enable utf8 character encoding in the shell as default? Is that possible?

    • user1686
      user1686 almost 8 years
      If each character appears as one square block, then UTF-8 already works; it's the font that lacks Unicode support.
    • phuclv
      phuclv almost 8 years
      use chcp 65001 to change codepage to UTF-8 and change the font to Consolas
    • Ryan Foley
      Ryan Foley over 7 years
      I switched to the SimSun-Ext B font and all of the characters are displaying correctly.
    • Ortix92
      Ortix92 over 7 years
      @grawity I was using uubntu mono and now switched to consolas. Instead of an empty square box I get a square box with a question mark inside. I also tried the chcp suggestion but it's already set to UTF-8 encoding when I checked the properties.
    • airstrike
      airstrike over 7 years
      Are you using ConEmu or Cmder by any chance?
    • Martin Vseticka
      Martin Vseticka over 7 years
    • Ortix92
      Ortix92 about 7 years
      I would like to point out that this issue is still not solved and that I still can't display unicode utf8 characters properly using ZSH
    • Yay295
      Yay295 almost 6 years
      June 2018 Update: Still not solved. The GitHub issues have been moved to github.com/Microsoft/console/labels/rendering.
    • Andrew Spencer
      Andrew Spencer over 4 years
      Per answer superuser.com/a/1402295/156020, it depends which glyphs are giving you trouble. I had this problem with glyphs used by the custom Git prompt from github.com/magicmonty/bash-git-prompt - DejaVu Sans Mono for Powershell was the only monospaced font I had installed that would show them.
    • randomness2077
      randomness2077 over 4 years
      Use github.com/microsoft/terminal. The terminal emulator under windows that doesn't suck (YET).
  • Kamil Maciorowski
    Kamil Maciorowski over 7 years
    While this may be the solution to the OP's problem, it's more a hint than a high quality answer. It may be improved by giving instructions on: 1) how to change font for Windows 10 Bash terminal; 2) how to install the said font (unless it's in every Windows 10 by default – I'm on Linux, I don't know).
  • StalkAlex
    StalkAlex about 7 years
    That's the true answer. You can choose font whatever you like that support UTF8. I installed Menlo and then forgot to change it in bash options, honestly didn't even thought about it.
  • smonff
    smonff about 6 years
    I used Ubuntu Mono before and had the problem with it. DejaVu Sans Mono solved the issue.
  • Sevron
    Sevron over 4 years
    Please note that I've tried all default options in windows (including Source Code Pro) and the checkmark character (✔) only worked for me with the "DejaVu Sans Mono" font suggested by @user3599934 !