Copyright © 2006–2018,2022 by Thomas E. Dickey
Luit is a filter that can be run between an arbitrary application and a UTF-8 terminal emulator. It will convert application output from the locale's encoding into UTF-8, and convert terminal input from UTF-8 into the locale's encoding. It is mainly used to support xterm.
Luit was written by Juliusz Chroboczek for the XFree86 Project in 2001-2002. There were improvements and fixes by several people, in particular Tomohiro Kubota's extensions for CJK encodings.
Like xterm, luit uses the MIT-X11 license. There was some early speculation (in 2001) about using GPL which can be seen in mailing list archive (this and this for example). However, because GPL-licensed code is/was unacceptable in that realm, that speculation came to nothing.
There was no maintainer for some time; I adopted it in 2006 to ensure that it continued to support xterm (details are listed in the luit.log.html file within the source).
Besides the maintenance issue that attracted my attention in 2005 (untested changes to compiled-in file locations by Xorg hackers), Luit has had from the outset a technical issue: its associated font-encoding library.
Juliusz Chroboczek used the font-encoding library to work around performance issues with direct use of iconv. This solution has proven to be a drawback:
I solved the problem by implementing an efficient conversion using iconv. Luit still supports the font-encoding library if it is found by the configure script. If you choose, luit can easily be built using iconv.
However, as of luit 2.0, the font-encoding library has been deprecated:
adobe-standard.enc. The encoding files are rarely packaged with luit, and oddly enough are never made a package dependency. The only other use that I am aware of for the files is for the defunct xprint program.
To see which ".enc" files luit may use, run
Here is sample output. The old version of luit can use only about a third of these encodings, i.e.,
big5.eten-0, big5hkscs-0, dec-special, gb18030.2000-0, gb18030.2000-1, gb2312.1980-0, gbk-0, ibm-cp437, ibm-cp850, ibm-cp852, ibm-cp866, iso8859-11, iso8859-13, iso8859-16, jisx0201.1976-0, jisx0208.1990-0, jisx0212.1990-0, ksc5601.1987-0, microsoft-cp1250, microsoft-cp1251, microsoft-cp1252, tcvn-0
With luit 2.0, the
option permits you to use the remaining files (as well as any
you may have customized):
adobe-dingbats, adobe-standard, adobe-symbol, armscii-8, ascii-0, big5-0, big5.cp950-0, cns11643-1, cns11643-2, cns11643-3, gb18030-0, iso8859-6.16, iso8859-6.8x, jisx0208.1983-0, ksc5601.1992-3, ksx1001.1997-0, ksx1001.1998-0, ksx1001.1998-3, ksxjohab-1, microsoft-ansi, microsoft-cp1253, microsoft-cp1254, microsoft-cp1255, microsoft-cp1256, microsoft-cp1257, microsoft-cp1258, microsoft-win3.1, mulearabic-0, mulearabic-1, mulearabic-2, mulelao-1, sun.unicode.india-0, suneu-greek, tis620-0, tis620-2, tis620.2529-1, tis620.2533-0, tis620.2533-1, viscii1.1-1
Normally luit uses your locale settings
to determine the corresponding character encoding. Use
--list-iconv to see the available choices,
Here is sample output on a suitably configured system. Your system may have fewer (locale support generally has been made more difficult to configure in systems geared toward novice developers such as Ubuntu). But the portable iconv implementation does support a wide range of encodings, and you may find additional encodings using
On the Debian system where I am writing this, that gives a list of 1168 encodings.
Here is a summary of the code growth, starting from XFree86 and contrasting against changes made in the Xorg fork. To provide a better comparison, I first discarded generated or externally-maintained files:
.gitignore, Makefile.in (when autogenerated), ChangeLog (when autogenerated), aclocal.m4 (when autogenerated), config.h.in (when autogenerated), autogen.sh, compile, config.guess, config.sub, configure, depcomp, install-sh, missing, mkdirs.sh, mkinstalldirs, builtin.c (generated), *.enc (generated)
In short, discard the files which are not maintained by the respective developers of each branch. The autogenerated files were initially included, and later dropped without any effort expended.
You may notice several things from the data:
Luit is known to work with
Aside from Solaris, luit had not been ported to other Unix systems before 2012.
For some older versions (noticed with HPUX and FreeBSD) you
may need to use the
-p command-line option to work
around a problem copying the terminal settings from the standard
input to the pseudo-terminal.
You should report bugs to me.
See the changelog for details:
changes with links...
Here are some screenshots of luit.
There are numerous references on the net to luit. Here are a few of the more interesting ones:
Less portable and well-integrated, but essentially the same concept.
Jonathan Nieder comments on the similarity of luit and cocot, suggesting that luit's description would be a good starting point for the latter.
Mosh is more closely related to luit and cocot than to quasi-terminal emulators such as screen and tmux. It aims to enforce a particular style of UTF-8 encoding.
For instance, Keith Winstein comments that mosh does not support ISO-2022 locking shifts whereas screen and luit do this.
This references both luit and cocot.