Is there anyway for a bash (or any other shell) script to detect whether the current terminal supports unicode characters? Is there anyway for a bash (or any other shell) script to detect whether the current terminal supports unicode characters? bash bash

Is there anyway for a bash (or any other shell) script to detect whether the current terminal supports unicode characters?


First, you're probably confusing Unicode with a particular encoding. Suppose you know that the termnal supports Unicode characters -- you still don't know how to print them!

You're probably thinking about something like UTF-8, the most popular Unicode encoding out there.

To get the encoding of the current locale, use

locale charmap

This is the encoding of the current locale, and theoretically it may differ from the encoding used by the terminal, but in that case something is broken on user's side.


In script print

:set encoding=utf-8

If you want your terminal support unicode, become new terminal with -u8 option

type in terminal xterm -u8