18

Right now, it looks like this:

enter image description here

1
  • it's a real 80x25 textmode terminal, so you can't use more than 256 characters. Use framebuffer console if you want real utf-8. Aug 16 '16 at 12:57
8

Sure (it's limited on the number of glyphs, but it seems your locale is using UTF-8 encoding).

I use this for testing:

#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
    printf '\033%%@'
else
    printf '\033%%G'
fi

and (calling it "utf8"), "utf8 on" turns the encoding on.

Using the example given with pstree, here is an example after running the script (before, the same sort of output as in the question):

screenshot after "utf8 on"

As noted in a comment, there's a script unicode_start which does more, but all that is needed to address the question posed is the small script used as an example.

Addressing a different comment: At least on my system (and in the screenshot shown in the question), all of the characters used by pstree are supplied in the 512-glyph font used by default for Unicode support in the Linux console.

Further reading:

1
  • 3
    The questioner appears to be running Debian 7. That has unicode_start in its kbd package, which does slightly more than your script.
    – JdeBP
    Aug 16 '16 at 13:33
17

Check that you have the locales package installed

dpkg -l locales

If not, install it

apt-get install locales

As root, type

dpkg-reconfigure locales

you can navigate that list with the up/down arrow keys, for example choose en_US-UTF-8

edit your .bashrc by adding the following lines:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

Run the localecommand ,the output should be similar to this::

LANG=en_US.UTF-8
LANGUAGE=en_US:en
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=
1
  • 2
    I do have the package installed - I think it comes by default with Debian Wheezy. It's just that the console wasn't in UTF-8 mode.
    – Mihai
    Aug 17 '16 at 10:29
3

Set CHARMAP="UTF-8" in /etc/default/console-setup.

Run systemctl daemon-reload && systemctl restart console-setup.service afterwards.

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.