19

Reading any data in Unicode does not display correctly in the Linux terminal (meaning the virtual terminal that opens without an X windows).

I read in a discussion here that installing programs such as JFBTERM, and it does work, so I was wondering if there isn't any way to configure (consolefonts?) the terminal to properly handle unicode without any extra software.

On Windows terminals (gnome-terminal, xterm, etc) it looks like this:

gnome-terminal

On virtual terminal it looks like this:

vt

On virtual terminal with JFBTERM it looks like this:

jbfterm

Here is a screenshot of the output of locale:

locale

Here is the output of showconsolefont:

showconsolefont

Does anyone know if it is possible to accomplish the same just with the default virtual terminal?

migrated from stackoverflow.com Feb 25 '13 at 8:06

This question came from our site for professional and enthusiast programmers.

5

The console font can load fonts to up to 512 (I think, or something like that) different glyphs; usually only 256 glyphs however.

To display Latin, Cyrrilic, or other languages that use less than 200 non complex symbols is no problem.

However, for complex scripts, or scripts needing a lot of different symbols (like japanese) you have no other possibility than using an extra layout to handle it.

Note that if the limit of 512 should be enough for ASCII and both Kana sets, there is the problem of the width.

CJK and Kana fit a square, they are twice the width of Latin letters. That is not something that the console can handle out of the box.

You could resort to old and ugly “Halfwidth Katakana” (and maybe even find an old font of such a thing), or set your console to 40 columns width and have latin letters be as wide as Kana.

I don't know of any such console font with Kana; you should draw your own (there are tools to do so, and you can just copy the dots of bitmap japanese font.

Also, you could use iconv to transliterate kana into ASCII.

3

You need a font that actually has these characters. Arch Linux for example recommends Lat2-Terminus16.

To try it, just issue the following command in a virtual console: setfont Lat2-Terminus16.

As for the rest, most modern distributions already support it out of the box.

2

In addition to LANG/LC_ALL, stty iutf8 is needed to tell the terminal what to do, you might need setfont then to load a useful font and mapping. If you still have problems check your kernel config for CONFIG_NLS_xx settings, you may need to modprobe nls_utf8 if it doesn't load automatically (I think this is only required for Unicode filenames though).

Some linux distributions provide unicode_start and unicode_stop scripts to automate this.

If less causes problems it may require the environment variable LESSCHARSET to be set (or unset if it's wrong).

Markus Kuhn's UTF-8 and Unicode FAQ for Unix/Linux is invaluable.

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.