luit is a
utility program used to translate the
character set
Character encoding is the process of assigning numbers to graphical characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using computers. The numerical values that make up a c ...
of a
computer program
A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. It is one component of software, which also includes software documentation, documentation and other intangibl ...
so that its output can be displayed correctly on a
terminal emulator
A terminal emulator, or terminal application, is a computer program that emulates a video terminal within some other display architecture. Though typically synonymous with a shell or text terminal, the term ''terminal'' covers all remote term ...
that uses a different character set.
Whereas
iconv converts the character set of
strings or
text file
A text file (sometimes spelled textfile; an old alternative name is flat file) is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists stored as data within a computer file system.
In ope ...
s
at rest, luit converts the input and output of programs running interactively.
Overview
The main purpose of luit is to allow "legacy" applications that use character sets other than
UTF-8
UTF-8 is a character encoding standard used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode Transformation Format 8-bit''. Almost every webpage is transmitted as UTF-8.
UTF-8 supports all 1,112,0 ...
to work with contemporary terminal emulators.
luit may be required today when connecting to a "legacy" host that only supports an older encoding, such as
ISO 8859-1
ISO/IEC 8859-1:1998, ''Information technology— 8-bit single-byte coded graphic character sets—Part 1: Latin alphabet No. 1'', is part of the ISO/IEC 8859 series of ASCII-based standard character encodings, first edition published in 19 ...
. For example, instead of running "
ssh legacy-machine
", a user may have to run "" to properly render French accented characters on a
UTF-8
UTF-8 is a character encoding standard used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode Transformation Format 8-bit''. Almost every webpage is transmitted as UTF-8.
UTF-8 supports all 1,112,0 ...
terminal.
luit is also used to properly render the output of applications that use
ISO 2022 character set switching. ISO 2022 is an older standard
that allowed an application to "switch" between different fonts, e.g., to mix
line-drawing characters with text or to display text in multiple languages and character sets. UTF-8 itself does not support switching fonts; the encoding is stateless and gives each unique character (including line-drawing characters) its own numerical encoding. It can be used to translate between these two encodings.
Examples of programs that require translation to run correctly on a UTF-8 terminal include earlier versions of
emacs
Emacs (), originally named EMACS (an acronym for "Editor Macros"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
/
MULE
The mule is a domestic equine hybrid between a donkey, and a horse. It is the offspring of a male donkey (a jack) and a female horse (a mare). The horse and the donkey are different species, with different numbers of chromosomes; of the two ...
,
and programs that use ISO 2022 shift sequences in
ANSI escape codes that switch to an alternate character set in order to draw
line-drawing characters.
luit is invoked automatically by
xterm
xterm is the standard terminal emulator for the X Window System. It allows users to run programs which require a command-line interface.
If no particular program is specified, xterm runs the user's Unix shell, shell. An X display device, dis ...
when necessary to translate program output into UTF-8,
for programs running on a local computer. When connecting remotely to another computer, the user must run luit directly.
luit interprets application output according to the locale's character set with ISO 2022 shifts and
ECMA-48
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape cha ...
escape sequences. If an application is speaking a different language than the locale's character set (one that may have matched the terminal emulator's expectations in the absence of luit), luit can misinterpret the application's output and produce corrupted output to the terminal.
History
luit was written in 2001 by Juliusz Chroboczek,
["luit author website"](_blank)
/ref> when major Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
distributions began migrating to the Unicode
Unicode or ''The Unicode Standard'' or TUS is a character encoding standard maintained by the Unicode Consortium designed to support the use of text in all of the world's writing systems that can be digitized. Version 16.0 defines 154,998 Char ...
character set from "legacy" encodings such as ISO 8859-1
ISO/IEC 8859-1:1998, ''Information technology— 8-bit single-byte coded graphic character sets—Part 1: Latin alphabet No. 1'', is part of the ISO/IEC 8859 series of ASCII-based standard character encodings, first edition published in 19 ...
.["UTF-8 and Unicode FAQ for Unix/Linux"](_blank)
/ref> It has since become a widely installed base utility, present on more than half of all Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
computer systems by some estimates. It is also part of IBM's AIX.
Implementations
There are two versions of luit: one maintained by Thomas Dickey["luit home page"](_blank)
/ref> as part of xterm
xterm is the standard terminal emulator for the X Window System. It allows users to run programs which require a command-line interface.
If no particular program is specified, xterm runs the user's Unix shell, shell. An X display device, dis ...
, and another formerly updated by Freedesktop.org. Some Linux distributions ship the latter version as part of their X11 utilities package. However, while migrating to GitLab, the latter fork was discontinued because it was unmaintained.
See also
* Mojibake
Mojibake (; , 'character transformation') is the garbled or gibberish text that is the result of text being decoded using an unintended character encoding. The result is a systematic replacement of symbols with completely unrelated ones, often ...
References
External links
*
{{Freedesktop.org
Unix text processing utilities