Frases

sábado, 14 de março de 2009

Xterm funcionando com UTF-8

You can run xterm in UTF-8 mode with:

xterm -u8

Or if you prefer to use UTF-8 the majority of the time, you can put this line in your .Xresoures file:

xterm*utf8: 1

If you specify this xterm resource, but then want to use an xterm in single-byte mode, you can start it with the +u8 option:

xterm +u8

If you use a UTF-8 enabled xterm, you probably want to make sure your locale is UTF-8 as well. For example, to switch your locale to Canadian English in UTF-8 mode, you would run (in bash):

export LANG=en_CA.UTF-8

You may also want to use a Unicode font for your xterm so as to be able to view more characters. Here is my xterm font resources:

xterm*font: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
xterm*wideFont: -misc-fixed-medium-r-normal-ja-18-120-100-100-c-180-iso10646-1

The wideFont resource is needed for languages such as Japanese. If a wideFont resource is not specified, xterm will try and use a font that is double the width of the regular font, but if this font does not exist, the Japanese characters will not display properly.

You can use xfontsel to choose a font, or use xlsfonts to get a listing of all the Unicode fonts installed on your system:

xlsfonts | grep iso10646-1 | less

I have installed the efont-unicode SuSE RPM to give me additional Unicode fonts to choose from.

If you would like to experiment with other terminals, try mlterm. I like it because it allows you to change the terminal encoding on the fly. You can do this with ctrl+.

Nenhum comentário: