Differences between version 19 and previous revision of UnicodeNotes.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 19 | Last edited on Wednesday, April 13, 2005 2:30:03 pm | by JohnMcPherson | Revert |
Older page: | version 18 | Last edited on Sunday, March 20, 2005 1:37:16 pm | by JohnMcPherson | Revert |
@@ -9,24 +9,47 @@
----
!!Terminals
-To turn on UTF-8 support in xterm (must have been compiled with utf-8 support, xterm version 145 or later), you must invoke xterm with a certain option:%%%
+! Testing your terminal
+To test if your terminal already supports UTF-8, try running the following command:
+<pre>
+ $ perl -e 'print chr(195) . chr(137) . "\n"'
+ É
+</pre>
+
+Copy the following text from this page and paste it into your terminal:
+<verbatim>
+echo Árvíztűrő tükörfúrógép
+</verbatim>
+
+If everything is working, you should see it both on the shell's input line and in the xterm's output. If it doesn't work, then the problem might be with the terminal, with the locale, or the lack of a fixed font that has those characters.
+
+Some shells (notably zsh(1)) can't cope with it (and gets confused if you start moving the cursor over the text), although xterm will still print the output fine.
+Bash copes with it just fine too.
+
+
+!Setting up xterm for UTF-8
+
To turn on UTF-8 support in xterm (it
must have been compiled with utf-8 support, xterm version 145 or later), you must invoke xterm with a certain option:
+<pre>
$ xterm -u8
+</pre>
-To turn on UTF-8 support in gnome-terminal, you print a certain escape sequence to the terminal:%%%
+To turn on UTF-8 support in gnome-terminal, you print a certain escape sequence to the terminal:
+<pre>
$ /bin/echo -ne '\033%G'
-
-You will also need an X11 font that has the unicode characters you want to display. However, if your distribution comes with utf-8 enabled terminals, then it will almost certainly come with a decent default font. Try%%%
- $ xlsfonts | grep iso10646%%%
+</pre>
+You will also need an X11 font that has the unicode characters you want to display. However, if your distribution comes with utf-8 enabled terminals, then it will almost certainly come with a decent default font. Try
+<pre>
+ $ xlsfonts | grep iso10646
+</pre>
to see unicode fonts you have access to. You should see some listed for "misc-fixed", which is the default font used by terminals.
-If you don't specify a font when you start xterm, it will default to "fixed". This font is an "alias" - for the specific font that it maps to, look in /usr/X11R6/lib/fonts/misc/fonts.alias:
-<pre>
+If you don't specify a font when you start xterm, it will default to "fixed". This font is an "alias" - for the specific font that it maps to, look in /usr/X11R6/lib/fonts/misc/fonts.alias:%%%
...
fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
...
-</pre>
+
You should change that to end with "-iso10646-1" instead, if you have a unicode version of the font installed. If you don't have administrator rights, you can always make your own alias file, eg put
fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
into a file such as $HOME/.fonts/fonts.alias and then put this directory as the first directory on your font path:
xset +fp $HOME/.fonts/fonts.alias
@@ -41,9 +64,9 @@
Also, you need to re-map the Alt key to be Meta.
Add
keysym Alt_L = Meta_L
-to your ~/.Xmodmap file (which should be sourced on login), or run
+to your ~
~/.Xmodmap file (which should be sourced on login), or run
xmodmap -e 'keysym Alt_L = Meta_L'
@@ -59,33 +82,30 @@
package.)
The system administrator can make this the default by putting
LC_ALL=en_NZ.UTF-8
-into /etc/environment (create it if it doesn't already exist).
+into /etc/environment (create it if it doesn't already exist - Note that this file might possibly be Debian-specific
).
As well as getting utf-8 support, this has the added advantage that locale-aware applications
will use the correct currency symbol, unit separator, date formatting etc for your locale.
(Eg, MozillaMail will show dates as dd/mm/yyyy instead of the default US mm/dd/yyyy)
If you don't have a friendly administrator or can't otherwise get root permissions, you should still be
-able to generate a locale if it isn't already installed:
+able to generate a locale yourself
if it isn't already installed:
1. generate a locale giving an encoding, a locale, and an output directory:
+<verbatim>
mkdir -p ~/pkg/locale/ && localedef -f UTF-8 -i en_NZ ~/pkg/locale/en_NZ.UTF-8
+</verbatim>
2. Set your LOCPATH environment variable to point to the correct directory
+<verbatim>
echo 'export LOCPATH=~/pkg/locale' >> ~/.bashrc
export 'export LC_ALL=en_NZ.UTF-8' >> ~/.bashrc
+</verbatim>
+! UXterm
The program uxterm is a shell script wrapper that sets up the locale properly then runs xterm with the right parameters.
-! Testing your terminal
-Copy the following text from this page and paste it into your terminal:
-<verbatim>
-echo Árvíztűrő tükörfúrógép
-</verbatim>
-
-If everything is working, you should see it both on the shell's input line and in the xterm's output. Some shells (notably zsh(1)) can't cope with it (and gets confused if you start moving the cursor over the text), although xterm will still print the output fine.
-Bash copes with it just fine too.
----
!!!Terminal programs
!!The "less" program