http://invisible-island.net/
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
luit -list-fontenc
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 -encoding
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,
e.g.,
luit -list-iconv
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
iconv -l
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.
Date | Branch | Release | Total Files |
Total Lines |
Diffstat | Diff against | ||
---|---|---|---|---|---|---|---|---|
Files Changed |
Lines Added |
Lines Deleted |
||||||
2002-12-08 | XFree86 | snapshot | 15 | 3490 | N/A | N/A | N/A | N/A |
2004-10-27 | XFree86 | snapshot | 15 | 3780 | 8 | 403 | 113 | 2002-12-08 |
2005-12-21 | Xorg | 1.0.1 | 21 | 3899 | 8 | 218 | 99 | 2004-10-27 |
2006-08-21 | XTerm | 20060820 | 20 | 6158 | 21 | 4044 | 1666 | 2004-10-27 |
2006-11-08 | Xorg | 1.0.2 | 21 | 3915 | 4 | 62 | 46 | 1.0.1 |
2008-01-31 | Xorg | 1.0.3 | 21 | 3918 | 9 | 108 | 105 | 1.0.2 |
2008-08-23 | XTerm | 20080823 | 20 | 6650 | 18 | 971 | 479 | 2006-08-21 |
2008-08-29 | XTerm | 20080829 | 20 | 6714 | 3 | 108 | 44 | 2008-08-23 |
2009-08-16 | XTerm | 20090816 | 21 | 7003 | 15 | 436 | 172 | 2008-08-29 |
2009-10-01 | Xorg | 1.0.4 | 21 | 3951 | 7 | 80 | 47 | 1.0.3 |
2009-10-14 | XTerm | 1.0-20091014 | 21 | 7080 | 8 | 149 | 47 | 2009-08-16 |
2010-02-09 | Xorg | 1.0.5 | 18 | 3973 | 3 | 36 | 14 | 1.0.4 |
2010-06-01 | XTerm | 1.0-20100601 | 32 | 7324 | 31 | 806 | 562 | 2009-10-14 |
2010-06-05 | XTerm | 1.0-20100605 | 32 | 7515 | 8 | 206 | 15 | 2010-06-01 |
2010-10-06 | Xorg | 1.1.0 | 20 | 4653 | 17 | 2702 | 2022 | 1.0.5 |
2010-11-28 | XTerm | 1.0-20101128 | 37 | 8820 | 25 | 1651 | 346 | 2010-06-05 |
2011-10-30 | XTerm | 1.2-20111030 | 37 | 9253 | 16 | 620 | 187 | 2010-11-28 |
2012-01-29 | XTerm | 1.2-20120129 | 37 | 9688 | 11 | 549 | 114 | 2011-10-30 |
2012-03-23 | Xorg | 1.1.1 | 20 | 4655 | 8 | 39 | 37 | 1.1.0 |
2012-10-14 | XTerm | 1.2-20121014 | 37 | 9727 | 15 | 873 | 834 | 2012-01-29 |
2013-02-17 | XTerm | 2.0-20130217 | 39 | 12586 | 21 | 3505 | 646 | 2012-10-14 |
2014-12-04 | XTerm | 2.0-20141204 | 39 | 12702 | 10 | 196 | 80 | 2013-02-17 |
2015-07-06 | XTerm | 2.0-20150706 | 39 | 12893 | 9 | 521 | 330 | 2014-12-04 |
2016-05-08 | XTerm | 2.0-20160508 | 39 | 12980 | 10 | 144 | 57 | 2015-07-06 |
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:
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.