Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting up the CPAN module for perl on CentOs 5, and one of the questions is 'Does your terminal support UTF-8?' (paraphrased). How do I find out?

share|improve this question
up vote 11 down vote accepted

Really, the surefire way to test is to download a text file and cat it in the terminal and see if everything looks ok.

or, if you can, recompile the terminal enabling the unicode option (assuming it has one).

what does $TERM and $LANG look like?

share|improve this answer
$TERM is "xterm" $LANG is "en_US.UTF-8" (aha!) The text file displays nicely in terminal, but curiously, not in Firefox. – Whatsit May 28 '09 at 16:16
yea, i actually encountered the same thing :-/ ... when i tried therek's suggestion, i got the question mark – theman_on_osx May 28 '09 at 17:02
$LANG just tells you what your system will use when writing to stdout/stderr. It doesn't say anything about the capabilities of the terminal. However, if everything your system prints of weird characters looks ok, then your terminal probably supports UTF-8. – Epcylon May 28 '09 at 17:58
This can even be automated, by displaying some text and checking its width (by reading the cursor position before and after). I posted a proof of concept a propos something else. – Gilles Apr 2 '13 at 18:17

Type this in your terminal:

echo -e '\xe2\x82\xac' 

If your terminal supports UTF-8 it will output the euro sign:

share|improve this answer
Not all fonts have the euro sign, so a different test code point might be advisable. – Michael Hampton Apr 2 '13 at 18:17

The lamest way: run following and check the output. It will be a capital O with circumflex if the terminal displays UTF-8.

perl -le 'print "\x{c3}\x{94}"'
share|improve this answer
I'm pretty sure my terminal supports UTF-8 now (passed the test suggested by theman_on_osx) but this just outputs a blank line. What's going on? – Whatsit May 28 '09 at 16:19
Maybe the font you're using in your terminal app does not support UTF-8 characters. – therek May 28 '09 at 18:13
I know this is extremely late but the UTF-8 Out flag makes that work better perl -CO -le 'print "\x{d4}"' – Ashley Feb 8 '11 at 21:49
Or without the -CO option, give Perl the correct UTF-8 bytes : $ perl -le 'print "\x{c3}\x{94}"' Ô – Tim Dec 31 '12 at 20:49

The most sure fire way is to use the ‘locale’ command. It will print out all the various and sundry variables that dictate what character set to use. For instance, this is my output on RHEL5.3, set to only use UTF-8 by default.

share|improve this answer
This doesn't test the terminal, only the locale setting (which in practice isn't always set by the terminal emulator, may not reflect the current state of the terminal, or may have been overridden by some user configuration). – Gilles Apr 2 '13 at 18:12

You may just use the following command:

locale charmap
share|improve this answer
This doesn't test the terminal. It only displays the locale settings. – grawity Feb 11 '13 at 15:16


wget -O -

This obviously requires wget or curl.

share|improve this answer
UTF=$(echo -e "\u263A")
if [[ ! "$UTF" =~ "A" ]]  ; then
 echo -n "UNICODE here!"
share|improve this answer
This doesn't test the terminal. It only tests whether the echo builtin supports \u. – grawity Feb 11 '13 at 15:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.