Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

gnome-terminal

On virtual terminal:

vt

On virtual terminal with jfbterm:

jbfterm

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

Thanks,

(UPDATE)

@BasileStarynkevitch: here is a screenshot of the locale

locale

@mr.spuratic: here is the output of showconsolefont

showconsolefont

share|improve this question

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

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

    
see: stackoverflow.com/a/12650490/390913 –  perreal Feb 25 '13 at 6:27
    
Thanks, but that does not work. :-( –  bruno.braga Feb 25 '13 at 6:42
    
what does locale tells you... –  Basile Starynkevitch Feb 25 '13 at 7:17
    
the same that the site had (en_US.UTF-8 for all) –  bruno.braga Feb 25 '13 at 11:31
    
Refer to the locale output in the updated question –  bruno.braga Feb 25 '13 at 23:25
add comment

3 Answers 3

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.

share|improve this answer
    
Thanks, messing a bit with the kernel internals sounds promising... do you have any references to guide me on that? –  bruno.braga Feb 25 '13 at 11:32
    
ubuntu also comes with the unicode_start/stop installed, but it does not work. I noticed that the vt is already in unicode_start mode, and when I turn it off, the text become messier than the block dots as in the image above. –  bruno.braga Feb 25 '13 at 11:33
    
OK, sounds like you just do not have a console font with Katakana characters, what does showconsolefont display? The standard console won't work well with CJK or anything with a large number of glyphs, it only allows at most 512 characters at a time, though it will easily work with ASCII+Katakana if that's all you need. You will need an ASCII+Katakana font in PSF format. fbterm/jfbterm don't have the 512 character limit, they work directly on the framebuffer pixels. –  mr.spuratic Feb 25 '13 at 13:26
    
Refer to the updated question for a screenshot of the showconsolefont command. Katakana, for the purpose of what I am doing, is enough... which font can I use to display it? I tried almost all of them in /usr/share/consolefonts without any luck... –  bruno.braga Feb 25 '13 at 23:25
add comment

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.

share|improve this answer
add comment

The console font can load fonts to up to 512 (I think, or something like that) different glyphs; usually only 256 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 ressort 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:

share|improve this answer
add comment

Your Answer

 
discard

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.