6

I've become stumped trying to get my terminal to show unicode characters. I've set the LOCALE/LANG environment variables to en_US.utf8:

locale
    LANG=en_US.utf8
    LC_CTYPE=en_US.utf8
    LC_NUMERIC="en_US.utf8"
    LC_TIME="en_US.utf8"
    LC_COLLATE="en_US.utf8"
    LC_MONETARY="en_US.utf8"
    LC_MESSAGES="en_US.utf8"
    LC_PAPER="en_US.utf8"
    LC_NAME="en_US.utf8"
    LC_ADDRESS="en_US.utf8"
    LC_TELEPHONE="en_US.utf8"
    LC_MEASUREMENT="en_US.utf8"
    LC_IDENTIFICATION="en_US.utf8"
    LC_ALL=


echo -e '\xe2\x82\xac' 
���

Everything I've found says to set the LANG and LOCALE vars, which I have done, but the problem persists. locale -a shows that the right locale is available:

Laptop:~:0:2030$ locale -a | grep utf
de_AT.utf8
de_BE.utf8
de_CH.utf8
de_DE.utf8
de_LI.utf8
de_LU.utf8
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN.utf8
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM.utf8
en_ZW.utf8
es_AR.utf8
es_BO.utf8
es_CL.utf8
es_CO.utf8
es_CR.utf8
es_DO.utf8
es_EC.utf8
es_ES.utf8
es_GT.utf8
es_HN.utf8
es_MX.utf8
es_NI.utf8
es_PA.utf8
es_PE.utf8
es_PR.utf8
es_PY.utf8
es_SV.utf8
es_US.utf8
es_UY.utf8
es_VE.utf8
fr_BE.utf8
fr_CA.utf8
fr_CH.utf8
fr_FR.utf8
fr_LU.utf8
ga_IE.utf8
nl_AW.utf8
nl_BE.utf8
nl_NL.utf8
pl_PL.utf8

I have also verified that this isn't limited to the CLI. Doing, for instance, u+2713 in VIM (which is something I use often), also gives a <?> character output.

In the gnome-terminal options, I have it set to use the default system font, but have tried all the fonts in the list with no assistance, and googling for "terminal unicode font" just continues the cycle of telling me to set my LOCALE/LANG.

--

Edit: As suggested below, I changed the locale/lang to en_US.UTF-8, which did not solve the problem:

Laptop:~:0:2013$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Laptop:~:0:2014$ echo -e '\xe2\x82\xac'
���
6

The solution was much simpler. I had to go to the GUI settings for gnome-terminal, visit Terminal -> Set Character Encoding -> UTF-8.

-- To keep this as the default in Ubuntu (and sorry to find out that it's a distro-specific solution in this SE forum):

gconftool --set --type=string /apps/gnome-terminal/profiles/Default/encoding en_US.UTF-8

  • 3
    Yeah. gnome-terminal still insits that ANSIX... is the current locale setting. I'll update the answer if I figure out how to change the default, because it still goes back to that when a new terminal window is opened. Thanks for your help with trying to figure this out. – Thomas Thorogood Dec 24 '13 at 16:39
  • 1
    Why it wasn't set to that in the first place is beyond understanding. GUI stuff. Anyways, that's great! You're welcome there! – user44370 Dec 24 '13 at 16:52
  • Thank you! I've been trying to figure out the same problem for months. – Michael Mior Jan 9 '14 at 14:17
2

I had the same problem with Terminal -> Set Character Encoding -> Unicode (UTF-8) correctly set. The problem was fixed by setting the encoding to something else and then back to UTF-8. The visible characters did not change right away, but newly typed started appearing correctly. No need to restart anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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