tohuwabohu In technology, chaos reigns supreme.

Unicode Characters in WSL


For those of us that are stuck on Windows and still want access to the bash terminal, WSL2.0 is a good compromise. There are a few catches that need additional work, for example problems with IntelliJ Java workspaces or displaying Unicode characters in the terminal.

The fix

To cut corners short, it does not matter how much you tinker with your settings or how many fonts you try. You’ll never make it work without installing the Windows Terminal (github). It actually offers a vast array of useful settings and if you like to keep your development workspaces inside the WSL you can change the startup profile to open the /home directory by default. You can also set a more specific path in the options.

In the end it does not really matter if you access the WSL through Windows Terminal or by launching the built-in WSL terminal directly from the start menu.

For many modern CLI tools I observed that emojis found their way into the terminal. In the example above I used the indicatif Rust library. It allows developers to provide some eye-candy for the user. When testing this library, I had the anticlimactic experience of those characters not showing up properly, but being replaced with the default placeholder character in the WSL terminal.

To pinpoint the problem, I copied two of the characters from the WSL terminal output: 🔍 and . Those translate to the respective codepoints U+1F50D and U+2840. In both the WSL terminal and the PowerShell, I echoed those unicode numbers with a bad outcome.

echo -e '\u2840'
echo -e '\u1F50D'

Conclusion

It seems like that some glyphs are missing. I tried various different settings, for example changing the code page to no avail. Sadly, there is no other way than installing additional software. At least Microsoft delivered a good piece of software with the Windows Terminal but the thought of switching the OS remains.

Tagged as: wsl