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?
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
- 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).
This is really more of a comment than an answer, but since SE doesn't allow me to comment...
You haven't provided enough information. Unicode provides over a million possible characters, of which over 100,000 have been defined. (The remaining ones are for when we contact extraterrestrials, or more likely for Earthlings' writing systems that haven't been encoded yet.) These are divided among about 150 scripts: Latin, Cyrillic, Arabic, Chinese... No font is going to supply glyphs (pictures of characters) for all those characters. (There are one or two that supply a box with the code point inside, but that's not what you want.)
As grawity said over two years ago, if you're getting a box where you expect a single character, then your application already is displaying Unicode (presumably the UTF-8 encoding of Unicode). What you lack is a font that supplies glyphs for whatever scripts you want to display. If you're displaying Russian, you'd want a font with Cyrillic characters; if you want to display Chinese, then you need a font with those characters. (Most such fonts will also display Latin characters--the kind we use for English--but not necessarily pretty.)
So my question for you is: what script are you trying to display? Until we know that, all answers will be guesses.
BTW, there are some scripts that are quite complicated, and only some programs will display them correctly, even if you do have the right font. Among these are Burmese, some Indic scripts (Devanagari, for example), and Arabic (which is written right-to-left, and has characters that should be displayed differently depending on adjacent characters).