http://invisible-island.net/xterm/
Copyright © 1997-2019,2020 by Thomas E. Dickey


Here is the latest version of this file.

XTerm – Frequently Asked Questions (FAQ)

What is XTerm?

From the manual page:

The xterm program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 and selected features from higher-level terminals such as VT320/VT420/VT520 (VTxxx). It also provides Tektronix 4014 emulation for programs that cannot use the window system directly. If the underlying operating system supports terminal resizing capabilities (for example, the SIGWINCH signal in systems derived from 4.3bsd), xterm will use the facilities to notify programs running in the window whenever it is resized.

That is, xterm (pronounced "eks-term") is a specific program, not a generic item. It is the standard X terminal emulator program.

This FAQ presents various useful bits of information for both the specific program as well as other programs that imitate it.

As a stylistic convention, the capitalized form is "XTerm", which corresponds to the X resource class name. Similarly, uxterm becomes "UXTerm".

Who wrote XTerm?

I've been working on xterm since early 1996 (see my changelog for details).

But the program is much older than that.

A Prehistory Perspective

A lot of people, cited at the bottom of the manual page wrote the original xterm program, maintained by the X Consortium (later part of The Open Group – I'm well aware of the distinction, but am citing when the work was done, not who the current owner may be). There is no changelog, and it is not clear who did what. Email from Jim Gettys (September 1998) provides some background:

Cast of thousands...

To give a bit of history, xterm predates X!

It was originally written as a stand-alone terminal emulator for the VS100 by Mark Vandevoorde, as my coop student the summer that X started.

Part way through the summer, it became clear that X was more useful than trying to do a stand alone program, so I had him retarget it to X. Part of why xterm's internals are so horrifying is that it was originally intended that a single process be able to drive multiple VS100 displays. Don't hold this against Mark; it isn't his fault.

I then did a lot of hacking on it, and merged several improved versions from others back in.

Notable improvements include the proper ANSI parser, that Bob McNamara did.

The Tek 4010 support came from a guy at Smithsonian Astrophysical Observatory whose name slips my mind at the moment.

Ported to X11 by Loretta Guarino.

Then hacked on at the X Consortium by uncounted people.

There is a git repository here which gives some more of xterm's prehistory.

Email from Doug Mink (October 1999) provides more background:

I was checking out the newly revised AltaVista search engine to see what was on the net about xterm, and I found your pages. I can add to the FAQ in that I was the "guy at the Smithsonian Astrophysical Observatory" Jim Gettys refers to. I am listed at the end of the man page under authors. What happened was that I was hired by SAO (after leaving the research staff at MIT) in October 1985 to write analysis software for the Spacelab 2 Infrared Telescope which was to fly on the Space Shuttle in 1985 less than six months after I was hired. I came with a tar tape full of software I had written for Unix and Tektronix terminals, but I was presented with a VS100 terminal which had an early version (X6 or so) of xterm, with no graphics capabilities. SAO is at Harvard, across Cambridge from MIT, where Jim Gettys was detailed from DEC to the X project, and Jim had connections with SAO, having worked here after college (MIT, where we had both worked at the observatory at various times); he was still sharing an apartment with an SAO colleague of mine, too. Anyway, everyone decided that since I knew Tektronix commands pretty well, and our group desparately needed the graphics capabilities, it would be a good use of my time to implement a Tektronix terminal emulator under X. So I set to work learning more C--I had only written a couple of wrappers to C I/O routines so I could use them with my Fortran software--and wrote a Tektronix emulator. The only X documentation at the time was the code itself. While I was at it, I wrote an improved Tektronix emulator for our Imagen laser printer which used the full resolution of that 300 dpi printer instead of the effective 100 dpi (i.e. jaggy) emultator distributed with the printer. The original xterm Tek emulator shared a window with the VT100 emulator, much like on the VT240 terminals which I had been using at MIT before I came to Harvard. With a VAX 750 running several VS100's, window creation was sloowww, so sharing a window was the quickest way to do things, and all of my software was written for that mode of operation, anyway. While I wrote the emulator so that my software would work on it, it was tested by the X group against a BBN graphics package, the name of which slips my mind right now.

Anyway, 15 years later, I am still using xterm and some of the same mapping software I wrote the emulator for. And I am still at the Smithsonian Astrophysical Observatory.

My Involvement

My involvement with xterm through XFree86 began at the end of 1995. This website has been "here" since 2001/6/5, replacing my ClarkNet page. I started the ClarkNet page 1996/12/31, as a followup to the release of ncurses 4.0) which featured xterm as one of the 16 programs I was involved with. From the outset, the page provided a link to a snapshot of the current source. Copies of patches which I sent to XFree86 were available on the ftp area.

XFree86 had its sources in CVS, but (like others in that era), were not directly visible to random developers. That came later. I started by downloading the sources (30Mb of compressed tar-files on a 56Kb phone connection took about 6 hours) and updating them with patches from the XFree86 mailing list.

Like the other programs that I worked on with others (vile, tin, lynx), I set up an RCS archive to track my changes locally before sending patches to the development list. As the XFree86 developers issued new patches, I would re-synchronize my archive. Later, XFree86 provided CVS (initially readonly). I was granted commit privileges on this in November 2000, and stopped mailing patches after #149.

Throughout this period, my work on xterm was released as part of XFree86. It was rare for a separate package to be provided. That was due to the potential conflict between the install procedures. Users of the downloads from my web/ftp site were predominantly individual developers.

There were exceptions. Christian Weisgerber proposed a package for FreeBSD ports later in 1999 (ports/15545: new port: x11/xterm, followup in March 2000). However, that was an exception. None of the Linux distributions provided a separate package before 2003 (when Mike Harris created a package of patch #177 for Red Hat). Again that is more of an exception than a rule:

Given that context (sources distributed via XFree86 CVS, releases via XFree86), the statement made by an Xorg hacker early in 2005 asserting that “It has not been maintained by anyone within the XFree86 or X.org trees for many years” was at best misleading.

After the “fork” (sic) of Xorg in 2004, I continued to commit changes for xterm in XFree86 CVS until patch #216 in mid-2006. I stopped at that point because it was not possible to incorporate changes into xterm which were not sent to me first. I still send patch announcements to both the XFree86 and Xorg mailing lists, of course.

At that point (mid-2006), the XFree86 CVS was no longer the primary development repository for xterm. My RCS archive filled that need. Later (starting in 2016), I provided Git snapshots using the RCS labels which I make in development:

Focus of this FAQ

This FAQ is oriented toward the version of xterm originally distributed with XFree86 (more commonly known as modern, or "new xterm", with a corresponding terminal description "xterm-new"), which was based on the X11R6.3 xterm, with the addition of ANSI color and VT220 controls.

What is a VT220?

Why a VT220?

The manual page mentions a VT220. Most terminal emulators documentation talk about VT100. But a VT100 is a rather limited subset of what people expect:

Initially, I was only interested in making colors workable for curses programs.

Later, I noticed that xterm had some support for what would now be termed as ISO-2022. That was a VT220 feature which preceded ISO-2022 called National Replacement Character sets. In any case, it was not a VT100 feature. There were some missing pieces. So I decided to fill in those pieces and make xterm a VT220 emulator. (VT220s do not do ANSI color either—the missing pieces were in other areas).

XTerm also provides features that are in neither VT100 nor VT220, which are used by other programs as "xterm emulation".

By the way, the control string used for setting the titles was not in a standard format:

ECMA-48 (the standard) does not describe this particular control, but prescribes its format (an operating system command). It does not use a BEL.

I revised that area starting in 1996,

In addition to implementing the VT220's National Replacement Character sets (see vttest screenshots), I added other features to emulate the successive models of DEC terminals. The decTerminalID resource (in 1996) lets users select the emulation to use. Because many of my changes were extensions (features not in any of DEC's terminals) and because well-behaved VT100 applications would not use features from higher-level terminals it was not initially important to prevent use of those by applications which assumed they were using just a VT100. Knowledgable users could easily configure xterm to emulate a VT220. In 2012, I changed the default from VT100 to VT420.

What is a State Table?

That was mentioned regarding the title strings. XTerm uses a state machine to handle incoming characters. That is essentially what a real terminal does. Other "xterm" terminal emulators typically do not do this, which makes them not do well with vttest.

Why not emulate VT320?

You could do that (by changing decTerminalID, but the results were not that interesting). In retrospect, the VT320 was a stopgap implementation designed to bridge between the VT200 series and the VT420. It provided a standard codepage (for ISO Latin-1).

While it had other features not found in the VT200-series, most of those are less useful in a terminal emulator. I did adapt the ECMA-48 scrolling operations which the VT320 interpreted as panning the visible display in the terminal's memory. Expect some difference there (if you can find an application on VMS which used the feature).

The VT320 was popular with developers of commercial terminal emulators, whose literature referred to it as supporting ANSI color. It did not do this.

Why emulate VT420?

The VT420 was interesting because it provided two features that could be useful:

A VT420, of course, supports all of the features in VT320, in turn all of the features in VT220, and in turn VT100. Users would not lose features by changing the default emulation to VT420. By changing the default emulation, most users would automatically be able to use applications (such as tmux) that could perform better if the left/right margin feature is available. I changed the emulation to VT420 in 2012 for this reason.

XTerm does not emulate some esoteric features (such as dual sessions) because those require hosts using special software, and no publicly-available documentation was available.

Why not emulate VT520?

Again, the VT500-series is less interesting because most of the features which are not hardware-specific (such as reporting transmission rate) are less useful.

However:

As for the other features, most are not useful in emulation (since they are hardware-specific). Additionally, these less-used features are not documented precisely and since the only point of providing them would be for successful interoperability with legacy applications, some reverse-engineering would be needed to provide a faithful emulation. To date there are no known terminal emulators which do that.

What platforms does it run on?

XTerm runs in all of the implementations of X11. As of 2000, I had built and run these since I started working on xterm in 1996:

The older configurations have X11R5 libraries. Only minor changes are needed to make xterm work on those systems. However, X11R6 provided better locale support, as well as new features such as the active icon. X11R7... not much to say there.

Since 2000, there have been many changes (including new platforms such as MacOS, NetBSD, OpenBSD, etc., as well as QNX, Cygwin, and Minix).

What is the latest version?

The most recent (and well supported) version of xterm is the one that I maintain:

What versions are available?

There are several other versions of xterm, based on xterm's source. These include

There are similar programs not based on xterm's source, which are compatible to different degrees. These include

Some of these use the VTE widget. Since that supplies most of the terminal emulation, the remaining differences between programs using VTE tend to be at the level of the window manager (menus, borders, etc.). Other (older) programs which are based on reusable widgets include dtterm and emu.

(I am aware of a few others, such as xcterm, but have not seen a working version of these).

Finally of course, there are a multitude of programs which set TERM to "xterm", in the hope that applications will treat them the same as xterm. For example,

Each of the programs noted here which are well-established and which are known to differ markedly from xterm have their own terminal descriptions in ncurses, to which TERM should be set. Otherwise, bug-reports are misdirected to ncurses which should have been addressed by the respective developers of these programs. These include

Comparing versions, by counting controls

Several of these programs are claimed (either by their developers, or their users) to emulate "most" of xterm. To me, "most" would be something quantifiable, e.g., 80 percent. To satisfy my curiousity, I wrote a script to extract the control sequence information from ctlseqs.txt. This counts each control sequence, as well as the variations such as setting bold, color, inverse video. Then I (laboriously) inspected these terminal implementations:

As of mid-November 2010, these were the latest implementations. I included data for the vt220 and vt102 to be able to contrast the various terminal emulators against those as well as xterm. There were:

For each control, there are three possibilities:

  1. "yes" — the terminal implements it, matching xterm. If xterm implements it, and it is a feature of vt220 or vt102, then in turn xterm's behavior must match vt220 or vt102.
  2. "partial" — the terminal implements it, but its behavior does not match the reference noted above.
  3. "no" — the terminal does not implement the control.

The control sequences document lists a few controls which xterm does not (completely) implement, e.g.,

None of the other terminal emulators implements those either.

Comparing against the control sequences document
yes partial no program
488 4 6 xterm-new
154 6 338 xterm-r6
188 5 305 vt220
104 0 394 vt102
204 3 291 rxvt
219 3 276 urxvt
191 2 305 putty
170 3 325 konsole
184 6 308 vte

Modern xterm implements 188 primary controls. In this table, vte ranks lower than PuTTY because it does not support vt52 emulation. This is not unusual, since the rxvt-based emulators do not, either. However, all vt100's provide this feature; programs lacking this are not really a vt100 emulator. On the other hand, PuTTY (which is not a vt100 emulator due to its incompatible wrapping behavior) supports this feature.

Aside from that, the various emulators implement much the same features from xterm. None implements as many as half of xterm's controls.

Comparing against xterm
yes partial no program
488 0 0 xterm-new
154 6 328 xterm-r6
182 2 304 vt220
98 0 390 vt102
204 3 281 rxvt
219 3 266 urxvt
189 2 297 putty
170 3 315 konsole
184 6 298 vte

DEC VT220 implements 96 primary controls. Modern xterm (as documented), implements most of the VT220. VTE implements fewer than half. The others are a little better. None of the others could be used as a real VT220.

Comparing against vt220
yes partial no program
182 0 6 xterm-new
78 6 104 xterm-r6
188 0 0 vt220
104 0 84 vt102
101 3 84 rxvt
106 3 79 urxvt
107 2 79 putty
100 3 85 konsole
88 6 94 vte

DEC VT102 (the actual flavor used for "vt100" in most cases), implements 68 primary controls. Again, VTE fares worst, and the others a little better.

Comparing against vt102
yes partial no program
98 0 6 xterm-new
70 6 28 xterm-r6
104 0 0 vt220
104 0 0 vt102
79 2 23 rxvt
81 2 21 urxvt
86 2 16 putty
85 3 16 konsole
60 1 43 vte

I have continued to add features to xterm:

The other programs change far more slowly. As a result they implement a smaller fraction of xterm's repertoire in 2019 than in 2010. Even for cases where they implement a function, it may not work properly (see for example the screenshot of VTE in the vttest NRCS examples).

In summary, none of the other terminal emulators emulates "most" of xterm. Instead, they implement the most commonly-used control sequences, and there are differences between them.

How do I ...

Not really problems, but frequently asked questions (the point of this, after all):

How do I change the font size?

XTerm uses fonts given as resource settings. You can switch between these fonts at runtime, using a menu. This is documented in the manpage, in the MENUS section.

X Consortium xterm provides popup menus, by pressing the control key together with the mouse button. Control right mouse button pops up the VT FONTS menu, from which you can select fonts that are specified in xterm's resources. Usually these are in increasing order of size.

Modern xterm provides the menu, plus a feature adapted from rxvt: pressing the shifted keypad plus or minus keys steps through the font menu selections, in order of their size.

XTerm's manpage does not document the syntax for X resources; it is done in the X documentation. If you are instead asking about a problem displaying a given font, it may be due to a problem with your resource settings.

How do I print the screen?

That depends on why you want to print it.

If you want a trace of an interactive session, you should use the script program. It records every character sent to the screen, recording them in a file typescript. There are two drawbacks to this approach:

Well, what about logging? Some versions of xterm support logging to a file. In fact modern xterm does. Logging was dropped from X Consortium xterm during X11R5 due to security concerns. Those were addressed, but logging was not reinstated (in fact there is a related bug in xterm). Some people prefer this, because it is convenient: you can start and stop logging a popup menu entry. However

Both script and logging are useful for recording, but they require interpretation to make sense of the trace. You probably would not send that trace to a printer (not twice, anyway).

If you want to print the contents of the screen, modern xterm implements, as part of the VT100 emulation, an "attached" printer.

There are limitations and tradeoffs using the "attached" printer, because it is an emulation:

If you use the popup menu to print the screen, this will close the printer pipe unless it was already opened by the application running in xterm.

How do I set up function keys?

With modern xterm, this is relatively simple. So I'll answer that first.

With X Consortium xterm, you had partial support for DEC VTxxx function keys. Function keys F1 to F12 correspond to DEC's F1 to F12 (sort of). Actually, DEC's VT220 terminals do not have codes for F1 through F5. They are reserved for local functions. And the VT220 (and up) terminals have 20 function keys. So you cannot do anything with the F13 through F20 (i.e., DO, HELP and SELECT). Finally, though xterm is reputed to be VT100-compatible, it has no support for the VT100 keypad (PF1 to PF4, and the "," key).

Modern (XFree86) xterm changed the X Consortium codes for F1 to F4 to match the VT100 PF1 to PF4, except when the emulation level is VT220 and up. In this case, it generates the same F1 to F4 codes as X Consortium xterm. Moreover, it adds a new resource sunKeyboard, which tells the program whether it has only 12 function keys (i.e., a Sun or PC keyboard). If so (this is selectable from the popup menu), you can use the control key with F1 to F12 to get F13 to F24, and use the "+" key on the keypad as an alias for "," (comma).

The emulation level for modern xterm is set via the resource decTerminalID, e.g., to 220 for a VT220. Once set, applications can set the emulation level up or down within that limit. DEC's terminals are configured in much the same way by a setup option.

That is the simple way, using a couple of new resources. The traditional way to get function keys involves translations. I have seen a few postings on the newsgroups that do this. Here is one from Bruce Momjian <root@candle.pha.pa.us> for a VT220:

xterm $XTERMFLAGS +rw +sb +ls $@ -tm 'erase ^? intr ^c' \
        -name vt220 -title vt220 -tn xterm-220 "$@" &

with the corresponding resources:

XTerm*VT100.translations: #override \n\
        
<Key>Home: string(0x1b) string("[3~") \n \
        
<Key>End: string(0x1b) string("[4~") \n
vt220*VT100.translations: #override \n\
~Shift  
<Key>F1: string(0x1b) string("OP") \n \
~Shift  
<Key>F2: string(0x1b) string("OQ") \n \
~Shift  
<Key>F3: string(0x1b) string("OR") \n \
~Shift  
<Key>F4: string(0x1b) string("OS") \n \
~Shift  
<Key>F5: string(0x1b) string("[16~") \n \
~Shift  
<Key>F6: string(0x1b) string("[17~") \n \
~Shift  
<Key>F7: string(0x1b) string("[18~") \n \
~Shift  
<Key>F8: string(0x1b) string("[19~") \n \
~Shift  
<Key>F9: string(0x1b) string("[20~") \n \
~Shift  
<Key>F10: string(0x1b) string("[21~") \n \
~Shift  
<Key>F11: string(0x1b) string("[28~") \n \
~Shift  
<Key>F12: string(0x1b) string("[29~") \n \
Shift   
<Key>F1: string(0x1b) string("[23~") \n \
Shift   
<Key>F2: string(0x1b) string("[24~") \n \
Shift   
<Key>F3: string(0x1b) string("[25~") \n \
Shift   
<Key>F4: string(0x1b) string("[26~") \n \
Shift   
<Key>F5: string(0x1b) string("[K~") \n \
Shift   
<Key>F6: string(0x1b) string("[31~") \n \
Shift   
<Key>F7: string(0x1b) string("[31~") \n \
Shift   
<Key>F8: string(0x1b) string("[32~") \n \
Shift   
<Key>F9: string(0x1b) string("[33~") \n \
Shift   
<Key>F10: string(0x1b) string("[34~") \n \
Shift   
<Key>F11: string(0x1b) string("[28~") \n \
Shift   
<Key>F12: string(0x1b) string("[29~") \n \
        
<Key>Print: string(0x1b) string("[32~") \n\
        
<Key>Cancel: string(0x1b) string("[33~") \n\
        
<Key>Pause: string(0x1b) string("[34~") \n\
        
<Key>Insert: string(0x1b) string("[2~") \n\
        
<Key>Delete: string(0x1b) string("[3~") \n\
        
<Key>Home: string(0x1b) string("[1~") \n\
        
<Key>End: string(0x1b) string("[4~") \n\
        
<Key>Prior: string(0x1b) string("[5~") \n\
        
<Key>Next: string(0x1b) string("[6~") \n\
        
<Key>BackSpace: string(0x7f) \n\
        
<Key>Num_Lock: string(0x1b) string("OP") \n\
        
<Key>KP_Divide: string(0x1b) string("Ol") \n\
        
<Key>KP_Multiply: string(0x1b) string("Om") \n\
        
<Key>KP_Subtract: string(0x1b) string("OS") \n\
        
<Key>KP_Add: string(0x1b) string("OM") \n\
        
<Key>KP_Enter: string(0x1b) string("OM") \n\
        
<Key>KP_Decimal: string(0x1b) string("On") \n\
        
<Key>KP_0: string(0x1b) string("Op") \n\
        
<Key>KP_1: string(0x1b) string("Oq") \n\
        
<Key>KP_2: string(0x1b) string("Or") \n\
        
<Key>KP_3: string(0x1b) string("Os") \n\
        
<Key>KP_4: string(0x1b) string("Ot") \n\
        
<Key>KP_5: string(0x1b) string("Ou") \n\
        
<Key>KP_6: string(0x1b) string("Ov") \n\
        
<Key>KP_7: string(0x1b) string("Ow") \n\
        
<Key>KP_8: string(0x1b) string("Ox") \n\
        
<Key>KP_9: string(0x1b) string("Oy") \n
 
!       <Key>Up: string(0x1b) string("[A") \n\
!       <Key>Down: string(0x1b) string("[B") \n\
!       <Key>Right: string(0x1b) string("[C") \n\
!       <Key>Left: string(0x1b) string("[D") \n\
 
*visualBell:    true
*saveLines:    1000
*cursesemul:    true
*scrollKey: true
*scrollBar: true

Note that real VT220 terminals use shifted function keys to mean something different: the user-programmable keys (i.e., DECUDK). Modern xterm supports this, but the translations do not (they're using shift to select F13 to F20).

Here's another one, from Robert Ess <ress@spd.dsccc.com>:

#!/bin/sh
 
#               vax
# 09-17-96      Bob Ess      - initial creation
# 09-26-96      Shig Katada  - Additional keybindings
#
#               Script file to incorporate keybindings and command line
#               options for connecting to a VAX node
 
# Usage statement
Usage(){
        echo
        echo " Usage  : vax -options"
        echo
        echo " Options: -80   for 80 column terminal"
        echo "          -132  for 132 column terminal"
        echo "          -fg colorname"
        echo "          -bg colorname"
        echo "          -fn fontname"
        echo "          -fb bold fontname"
        echo "          -host [altair] [devel] [leonis] [castor]"
        echo ""
        echo " Example: \"vax -80 -fg white -bg black -fn 9x15 -fb 9x15b -host castor\""
        echo "          Starts a VAX session with an 80 column terminal"
        echo "          with a black background, white foreground, a normal"
        echo "          font of 9x15 and a bold font of 9x15b, and connects"
        echo "          to the node 'castor'"
        echo
        echo "          If you need additional help, please call Workstation"
        echo "          Services at x92396."
        echo
        exit 1
}
 
# Default to a black foreground with a white background.
# Use the 9x15 and 9x15bold fonts. Connect to castor by default.
#
FG=black
BG=white
HOST=castor
FONT=9x15
BFONT=9x15bold
COLS=80
 
# Parse the command line arguments
#
while [ $# != 0 ];
do
        case $1 in
                -80)    COLS=80
                        FONT=spc12x24c
                        BFONT=spc12x24b
                        shift
                        ;;
                -132)   COLS=132
                        FONT=9x15
                        BFONT=9x15b
                        shift
                        ;;
                -fg)    shift
                        FG=$1
                        shift;;
                -bg)    shift
                        BG=$1
                        shift;;
                -fn)    shift
                        FONT=$1
                        shift;;
                -fb)    shift
                        BFONT=$1
                        shift;;
                -host)  shift
                        HOST=$1
                        shift;;
                -help)  Usage;;
                *)      Usage;;
        esac
done
 
xterm  -title "VAX" -sb -sl 1200 -geo ${COLS}x24 -fg ${FG} -bg ${BG} \
        -cr red -fn ${FONT} -fb ${BFONT} -xrm \
        'XTerm*VT100.translations:     #override \n\
        <Key>Insert:            string(\001) \n\
        Shift <Key>Up:          scroll-back(1,lines) \n\
        Shift <Key>Down:        scroll-forw(1,lines) \n\
        Shift <Key>Right:       string(0x1b) string("f") \n\
        Shift <Key>Left:        string(0x1b) string("b") \n\
        Shift <Key>Delete:      string(0x1b) string(0x08) \n\
        Shift <Key>Tab:         string(0x1b) string("*") \n\
        <Key>0x1000FF0D:        scroll-back(1,page) \n\
        <Key>0x1000FF0E:        scroll-forw(1,page) \n\
        <Key>0x1000FF09:        string(\010) \n\
        <Key>0x1000FF0A:        string(\005) \n\
        <Key>BackSpace:         string(0xff) \n\
        <Key>Select:            select-start() \n\
        <Key>0x1000FF02:        select-end(PRIMARY,CUT_BUFFER0) \n\
        Meta <Key>0x1000FF02:   select-end(CLIPBOARD) \n\
        <Key>0x1000FF04:        insert-selection(PRIMARY,CUT_BUFFER0) \n\
        Meta <Key>0x1000FF04:   insert-selection(CLIPBOARD) \n\
        <Key>F1:                string(0x1b) string("OP") \n\
        <Key>F2:                string(0x1b) string("OQ") \n\
        <Key>F3:                string(0x1b) string("OR") \n\
        <Key>F4:                string(0x1b) string("OS") \n\
        <Key>F5:                string(0x1b) string("OA") \n\
        <Key>F11:               string(0x1b) string("[23~") \n\
        <Key>F12:               string(0x1b) string("[24~") \n\
        <Key>KP_0:              string(0x1b) string("Op") \n\
        <Key>KP_1:              string(0x1b) string("Oq") \n\
        <Key>KP_2:              string(0x1b) string("Or") \n\
        <Key>KP_3:              string(0x1b) string("Os") \n\
        <Key>KP_4:              string(0x1b) string("Ot") \n\
        <Key>KP_5:              string(0x1b) string("Ou") \n\
        <Key>KP_Divide:         string(0x1b) string("OP") \n\
        <Key>KP_Multiply:       string(0x1b) string("[29~") \n\
        <Key>KP_Enter:          string(0x1b) string("OM") \n\
        <Key>KP_Subtract:       string(0x1b) string("Om") \n\
        <Key>KP_Add:            string(0x1b) string("Ol") \n\
        <Key>KP_Decimal:        string(0x1b) string("On") \n\
        <Btn1Down>:             select-start() \n\
        <Btn1Motion>:           select-extend() \n\
        <Btn1Up>:               select-end(PRIMARY,CUT_BUFFER0) \n\
        Button1<Btn2Down>:      select-end(CLIPBOARD) \n\
        Button1<Btn2Up>:        ignore()'
 \
        -e telnet $HOST &

Finally (for the moment) is a further modification of Robert Ess's script by Erik Ahlefeldt, <oahlefel@metz.une.edu.au>. From his readme file, for vmsterm:

This script is for people who wish to connect from a Linux or Unix computer to a VMS computer using telnet and get a good VT100 or VT220 emulation. The key mappings have been specifically designed to emulate the VT terminal auxiliary numeric keypad, so that you can use VMS EDT and TPU editors, as well as the many VMS applications use keys PF1 to PF4. The script should work with any recent version of Xterm using a standard extended IBM PC keyboard or a Sun keyboard.

About the keymappings. First the auxiliary numeric keypad. My prime objective with these mappings was to produce a setup that I could use with the EDT and TPU editors which make extensive use of the numeric keypad. The top row of keys PC numeric keypad (Num Lock, Divide, Multiply, Subtract) are where you find PF1, PF2, PF3, PF4 on a VT keyboard, so I have mapped them to PF1 thru PF4. The PC numeric keypad Add key (+) takes up the space of two keys which are Minus and Comma on the VT keyboard – I have mapped it to Comma (Delete Character in the EDT editor). I have then used the PC Pause key to map to VT key Minus (Delete Word in the EDT editor). The remaining keys on the auxiliary numeric keypad are the same for PC and VT.

The six keys between the main and numeric keypads on the PC (Insert, Home, Page Up, Delete End, Page Down) are usually mapped to the VT keys by either position or by (approximate) function. As I rarely use these keys I have mapped them by function as follows: PC key Insert to VT Insert Here, PC Home to VT Find, PC Page Up to VT Prev, PC Delete to VT Remove, PC End to VT Select, PC Page Down to VT Next.

Function keys.
There are 12 function keys on the PC keyboard and 20 on the VT keyboard, so I map PC F1 thru F12 to VT F1 thru F12 (except for F1 thru F5 as noted below) and PC Shift F1 thru Shift F10 to VT F11 thru F20.

The VT keys F1 thru F5 are local hardware function keys so there is nothing to emulate, however some PC to VT emulations in the past have mapped PF1 thru PF4 here, so I have done that too, even though they are already mapped on the auxiliary numeric keypad.

Xterm functionality.
You lose some xterm functions when you remap the keyboard, however this script implements a scroll back buffer of 1000 lines which you scroll through using Shift and Up (a.k.a. Up Arrow or Cursor Up key) or Shift and Down.

a summary of the keyboard mapping:

PC Key     maps to   VT Key.
------               ------
F1                   PF1
F2                   PF2
F3                   PF3
F4                   PF4
F5                   unused
F6                   F6
F7                   F7
F8                   F8
F9                   F9
F10                  F10
F11                  F11
F12                  F12
Shift F1             F11
Shift F2             F12
Shift F3             F13
Shift F4             F14
Shift F5             F15 (Help)
Shift F6             F16 (Do)
Shift F7             F17
Shift F8             F18
Shift F9             F19
Shift F10            F20
Shift F11            F11
Shift F12            F12
Print                Help (F15)
Cancel               Do   (F16)
Pause                Keypad Minus

Insert               Insert Here
Delete               Remove
Home                 Find
End                  Select
Prior                Prev
Next                 Next
BackSpace            BackSpace (sends DEL - ascii 127)

Num_Lock             PF1
KP_Divide            PF2
KP_Multiply          PF3
KP_Subtract          PF4
KP_Add               Keypad Comma
KP_Enter             Enter
KP_Decimal           Period
KP_0                 Keypad 0
KP_1                 Keypad 1
KP_2                 Keypad 2
KP_3                 Keypad 3
KP_4                 Keypad 4
KP_5                 Keypad 5
KP_6                 Keypad 6
KP_7                 Keypad 7
KP_8                 Keypad 8
KP_9                 Keypad 9
Up                   Up
Shift Up             Scroll Back
Down                 Down
Shift Down           Scroll Forward
Right                Right
Left                 Left

and the script:

#!/bin/sh
#               vmsterm
#               from an original script by Bob Ess
#               key translations by Erik Ahlefeldt 
#
#               Script file using Xterm and telnet to connect to a VMS host
#               and give a decent vt220 emulation.
#
# Usage statement
Usage(){
        echo
        echo " Usage  : vmsterm -options"
        echo
        echo " Options: -80   for 80 column terminal"
        echo "          -132  for 132 column terminal"
        echo "          -bg colorname"
        echo "          -fg colorname"
        echo "          -fn fontname"
        echo "          -fb bold fontname"
        echo "          -host [crusher.saltmine.com] [earth] [192.168.7.7]" 
        echo ""
        echo " Example: \"vmsterm -80 -fg white -bg black -fn 9x15 -fb 9x15b -host earth\""
        echo "          Starts a VMS session with an 80 column terminal"
        echo "          with a black background, white foreground, a normal"
        echo "          font of 9x15 and a bold font of 9x15b, and connects"
        echo "          to the node 'earth'"
        echo ""
        echo " Example: \"vmsterm -host earth\""
        echo "          Starts a VMS session with default terminal settings "
        echo ""
        echo " Example: \"vmsterm -help\""
        echo "          Displays vmsterm options "
        echo
        exit 1
}
 
# Default to a black foreground with a white background.
# Use the 9x15 and 9x15bold fonts. Connect to 192.168.3.3 by default.
#
FG=black
BG=white
HOST=192.168.3.3
FONT=9x15
BFONT=9x15bold
COLS=80
 
# Parse the command line arguments
#
while [ $# != 0 ];
do
        case $1 in
                -80)    COLS=80
                        FONT=spc12x24c
                        BFONT=spc12x24b
                        shift
                        ;;
                -132)   COLS=132
                        FONT=9x15
                        BFONT=9x15b
                        shift
                        ;;
                -fg)    shift
                        FG=$1
                        shift;;
                -bg)    shift
                        BG=$1
                        shift;;
                -fn)    shift
                        FONT=$1
                        shift;;
                -fb)    shift
                        BFONT=$1
                        shift;;
                -host)  shift
                        HOST=$1
                        shift;;
                -help)  Usage;;
                *)      Usage;;
        esac
done
 
xterm   -title "VMSTERM" -sb -sl 1000 -geo ${COLS}x24 -fg ${FG} -bg ${BG} \
        -cr blue -fn ${FONT} -fb ${BFONT} -xrm \
        "XTerm*vt100.translations: #override \\
        ~Shift  <Key>F1:        string(0x1b)    string("
OP") \\
        ~Shift  <Key>F2:        string(0x1b)    string("
OQ") \\
        ~Shift  <Key>F3:        string(0x1b)    string("
OR") \\
        ~Shift  <Key>F4:        string(0x1b)    string("
OS") \\
        ~Shift  <Key>F5:        string("
Break") \\
        ~Shift  <Key>F6:        string(0x1b)    string("
[17~") \\
        ~Shift  <Key>F7:        string(0x1b)    string("
[18~") \\
        ~Shift  <Key>F8:        string(0x1b)    string("
[19~") \\
        ~Shift  <Key>F9:        string(0x1b)    string("
[20~") \\
        ~Shift  <Key>F10:       string(0x1b)    string("
[21~") \\
        ~Shift  <Key>F11:       string(0x1b)    string("
[23~") \\
        ~Shift  <Key>F12:       string(0x1b)    string("
[24~") \\
        Shift   <Key>F1:        string(0x1b)    string("
[23~") \\
        Shift   <Key>F2:        string(0x1b)    string("
[24~") \\
        Shift   <Key>F3:        string(0x1b)    string("
[25~") \\
        Shift   <Key>F4:        string(0x1b)    string("
[26~") \\
        Shift   <Key>F5:        string(0x1b)    string("
[28~") \\
        Shift   <Key>F6:        string(0x1b)    string("
[29~") \\
        Shift   <Key>F7:        string(0x1b)    string("
[31~") \\
        Shift   <Key>F8:        string(0x1b)    string("
[32~") \\
        Shift   <Key>F9:        string(0x1b)    string("
[33~") \\
        Shift   <Key>F10:       string(0x1b)    string("
[34~") \\
        Shift   <Key>F11:       string(0x1b)    string("
[28~") \\
        Shift   <Key>F12:       string(0x1b)    string("
[29~") \\
                <Key>Print:     string(0x1b)    string("
[28~") \\
                <Key>Cancel:    string(0x1b)    string("
[29~") \\
                <Key>Pause:     string(0x1b)    string("
Om") \\
                <Key>Insert:    string(0x1b)    string("
[2~") \\
                <Key>Delete:    string(0x1b)    string("
[3~") \\
                <Key>Home:      string(0x1b)    string("
[1~") \\
                <Key>End:       string(0x1b)    string("
[4~") \\
                <Key>Prior:     string(0x1b)    string("
[5~") \\
                <Key>Next:      string(0x1b)    string("
[6~") \\
                <Key>BackSpace: string(0x7f)    
\\
                <Key>Num_Lock:  string(0x1b)    string("
OP") \\
                <Key>KP_Divide: string(0x1b)    string("
OQ") \\
                <Key>KP_Multiply: string(0x1b)  string("
OR") \\
                <Key>KP_Subtract: string(0x1b)  string("
OS") \\
                <Key>KP_Add:    string(0x1b)    string("
Ol") \\
                <Key>KP_Enter:  string(0x1b)    string("
OM") \\
                <Key>KP_Decimal: string(0x1b)   string("
On") \\
                <Key>KP_0:      string(0x1b)    string("
Op") \\
                <Key>KP_1:      string(0x1b)    string("
Oq") \\
                <Key>KP_2:      string(0x1b)    string("
Or") \\
                <Key>KP_3:      string(0x1b)    string("
Os") \\
                <Key>KP_4:      string(0x1b)    string("
Ot") \\
                <Key>KP_5:      string(0x1b)    string("
Ou") \\
                <Key>KP_6:      string(0x1b)    string("
Ov") \\
                <Key>KP_7:      string(0x1b)    string("
Ow") \\
                <Key>KP_8:      string(0x1b)    string("
Ox") \\
                <Key>KP_9:      string(0x1b)    string("
Oy") \\
        ~Shift  <Key>Up:        string(0x1b)    string("
[A") \\
        Shift   <Key>Up:        scroll-back(1,lines) 
\\
        ~Shift  <Key>Down:      string(0x1b)    string("
[B") \\
        Shift   <Key>Down:      scroll-forw(1,lines) 
\\
                <Key>Right:     string(0x1b)    string("
[C") \\
                <Key>Left:      string(0x1b)    string("
[D")" \
        -e telnet $HOST 

How do I set the title?

The control sequences for doing this are documented in ctlseqs.ms.

The usual context for this question is setting the title according to the current working directory. People post answers to this periodically on the newsgroups. Here is one that I have seen, from Roy Wright <nobody@roystoy.dseg.ti.com>. In your /etc/profile after:

if [ "$SHELL" = "/bin/pdksh" -o "$SHELL" = "/bin/ksh" ]; then
        PS1="! $ "
elif [ "$SHELL" = "/bin/zsh" ]; then
        PS1="%m:%~%# "
elif [ "$SHELL" = "/bin/ash" ]; then
        PS1="$ "
else
        PS1='\u@\h:\w\$ '
fi

add:

if [ "$TERM" = "xterm" ]; then
        PS1="\033]2;\u@\h:\w\007bash$ "
fi

The terminator "\007" is a problem area. XTerm historically uses this character, though it is non-ANSI. The "correct" character should be a "\233" string terminator, or "\033\\", which is the 7-bit equivalent. Modern xterm recognizes either (the "\007" or string terminator); waiting for the first of these.

You may have resource or environment problems that prevent you from setting the title at all. Newer xterms (starting somewhere in X11R5) use the $LANG variable. If your locale is incorrectly installed, you will be unable to set the xterm's title. As noted by Mikhail Teterin <mi@rtfm.ziplink.net>: Make sure that the locale (LANG and/or LOCALE environment variable) is known to X Window System. Check ${X11ROOT}/lib/X11/locale.* for it. If it is not listed in either one of the files, find the nearest match and add an alias to it. Restart X if you have made changes.

On a related note, some people want to know how to read the title from an xterm. This works for modern xterm and dtterm, but not for other variations:

#!/bin/ksh
# Echo the current X term title bar to standard output.
# Written by Icarus Sparry <icarus@bath.ac.uk> 11 Apr 1997
#
exec </dev/tty
old=$(stty -g)
stty raw -echo min 0  time ${1-10}
print "\033[21t\c" > /dev/tty
IFS='' read -r a
stty $old
b=${a#???}
print -R "${b%??}"

But it is possible to avoid escape sequences altogether (from Hemant Shah <shah@typhoon.xnet.com>):

$ xprop -id $WINDOWID | grep WM_NAME
WM_NAME(STRING) = "this is my title"
current_title=$(xprop -id $WINDOWID | grep WM_NAME | cut -d= -f2)

Here's another source of information: Xterm-Title HowTo

Standard xterm does not implement a blinking cursor. Some of the variations do: dtterm, GNOME Terminal, and modern xterm (from mid 1999, patch 107).

Frequent problems

Starting xterm, or not

XTerm does not run (no available pty's)

Your copy of xterm may not have enough permissions to use existing pty's:

Perhaps your system does not have enough pty's, or (problems reported with newer Linux kernels supporting Unix98 pty's, beginning with RedHat 6.0) the major device numbers of the pty's may have changed during a kernel upgrade. (This is described in /usr/src/linux/Documentation).

See also the MAKEDEV script, which usually exists under /dev.

I need /etc/termcap

If you have a termcap version of xterm on a system with no termcap libraries, you may also be missing /etc/termcap.

A workaround is to copy /usr/X11R6/lib/X11/etc/xterm.termcap to /etc/termcap.

This is fixed another way starting with XFree86 3.3.1. If xterm cannot find the terminal description, it will accept that, though it will print a warning. If xterm does not find the termcap entry, it will not set the $TERMCAP variable.

Why does $LD_LIBRARY_PATH get reset?

If xterm is running setuid (which is needed on some systems which have no wrappers for opening pty's and updating utmp), newer systems automatically set or reset environment variables which are considered security problems. These include $PATH and $LD_LIBRARY_PATH, since they affect the choice of which programs are run if not specified via a full pathname.

This means, for example, that if you attempt to run

xterm -e foo

where foo is a program that uses shared libraries in /usr/local/lib, then the command will fail, because /usr/local/lib is not considered part of root's environment.

Modern Unix systems (such as recent Solaris and HPUX versions) do not require you to run xterm setuid. Some will result in odd malfunctions if you do this.

Why do the -e and -ls options not work together?

XTerm has two useful options for controlling the shell that is run:

-e
tells xterm to execute a command using the remaining parameters after this option.
-ls
tells xterm to invoke a login shell, making it read your .login file, for instance.

The two are not compatible. If you specify both, xterm uses -e, and if that fails for whatever reason will fall through to the -ls option. It cannot (in general) combine the two, since some shells permit this (e.g., bash), and others do not (e.g., tcsh).

Why is my screen size not set?

Well, it may be set, but not correctly. You may notice these symptoms:

XTerm knows how big the screen is (of course), and tries to tell your applications (e.g., by invoking ioctl's and sending SIGWINCH). But sometimes it cannot:

Most full-screen applications such as vi are designed to use the ioctl calls that return the screen size. When they fail, the applications use the size defined in the terminal's terminfo or termcap description.

You may be able to use the resize program to issue the ioctl's that will notify your application of the actual screen size. This does not always work for the reasons just mentioned. Newer versions of stty let you specify the screen size, though it will not be updated if you resize the xterm window:

stty rows 24 columns 80

Most full-screen applications also check if the $LINES and $COLUMNS variables are set, using those values to override the terminal description:

setenv LINES 24
setenv COLUMNS 80

Why 65 lines? The standard xterm terminfo description specifies 65 lines, perhaps because someone liked it that way. Real VT100's are 24 lines. I once used (and wrote applications for) a Bitgraph terminal, which emulated VT100, but displayed 65 lines.

Why are the menus tiny?

Everything seems to work, except that the xterm menus (VT options, fonts, etc.) do not display properly; the menus pop up, but only with a tiny display area in which none of the options are visible (and only part of the menu title is visible).

You have specified the geometry for xterm too high in the hierarchy, and that 24x80 (or whatever the -geometry parameter happens to be) is applying to the menus in pixels. This resource makes the geometry apply to the menus as well as the VT100 widget:

XTerm*geometry: 80x24

while this applies only to the VT100 widget (which is probably what you intended):

XTerm.VT100.geometry: 80x24

or better yet (to allow for the toolbar option, which uses a level of widget hierarchy):

XTerm*VT100.geometry: 80x24

Font problems

My terminal doesn't show box characters

XTerm displays the 7-bit ASCII and VT100 graphic characters (including box corners) using specially arranged fixed-pitch fonts. The first 32 glyph positions (which would correspond to nonprinting control characters) are used to hold the VT100 graphic characters. Some fonts that otherwise look fine (such as courier) do not have glyphs defined for these positions. So they display as blanks. Use xfd to display the font.

Modern xterm can form its own line-drawing characters (see patch 90, for example). It does not draw all of the graphic characters, only those that may be done with straight lines. But those are the most used, making most of the fixed-pitch fonts useful for xterm.

You may also have a problem with the terminfo description. As distributed, the X11R6 terminfo for xterm does not have the acsc string defined, so most implementations of curses do not try to use the alternate character set.

Finally, some people confuse the VT100 graphic characters with the VT220 support for DEC technical character set. These are distinct (7-bit) character sets. Xterm currently does not support this.

The bold font is ugly

XTerm lets you directly specify one bold font, which is assumed to correspond to the default font. Older versions of xterm make a fake bold font for the other choices via the fonts menu by drawing the characters offset by one pixel. I modified xterm to ask the font server for a bold font that corresponds to each font (other than the default one). Usually that works well. However, sometimes the font server gives a poor match. Xterm checks for differences in the alignment and size, but the font server may give incorrect information about the font size. The scaled bitmap font feature gives poor results for the smaller fonts. In your X server configuration file, that can be fixed by disabling the feature, e.g., by appending ":unscaled" to the path:

FontPath        "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath        "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath        "/usr/lib/X11/fonts/misc/:unscaled"

You can suppress xterm's overstriking for bold fonts using the alwaysBoldMode and related resources. However, rendering ugly bold fonts is a "feature" of the font server. In particular, the TrueType interface provides less ability to the client for determining if a particular font supports a bold form.

I see little dots on the screen

Well, I do. Perhaps you do not. It depends on the fonts you choose, and how you use them.

Standard xterm has a "normal" font for which a bold font can be chosen, and several alternative fonts, useful for changing the font size. The alternative fonts do not have corresponding bold fonts. Xterm simulates bold fonts in this case by overstriking the character one pixel offset. That can make an bold character extend into the area that another character occupies. When erasing a bold character from the screen, xterm does not erase the extra pixel. This is corrected in modern xterm, subject to the available fonts (from late 1998, patch 85). For each font, it asks the font server for a corresponding bold font. Your font server may not have the bold font (or it may incorrectly report that it does). But it usually works.

My terminal doesn't display Cyrillic characters

Cyrillic encodings typically use characters in the range 128-159. For a VT220 (or any terminal that follows ISO 6429), those are treated as control characters. Still, some people want to use KOI8-R, etc. I modified xterm in patch 175 to add an option (-k8) and corresponding resource settings to allow them to customize their environment. Here is a sample script and resource file which I use for testing this configuration.

I see boxes instead of characters in uxterm

XTerm may show boxes instead of characters if the font that you have selected does not contain those characters. Normally you can fix most of that using the UTF-8 feature, with uxterm. However, your X resource settings may be the source of the problem.

One pitfall to setting X resources is that they allow you to specify wildcards, e.g., the "*" character. When you give a wildcard, the X resource matches any number of levels in the widget hierarchy.

XTerm has more than one widget matching "font" at different levels of the hierarchy. There are the popup menus, and there are the fonts used for uxterm. The latter is where an overbroad pattern can cause xterm to use a different font than you expect.

Suppose your resource setting includes this pattern

*VT100*font: fixed

It could be interpreted as this:

*VT100.font: fixed
*VT100.utf8Fonts.font: fixed

XTerm uses the utf8Fonts subresources to provide runtime-switchable fonts between IS0-8859-1 (Latin-1) and ISO-10646 (Unicode). Modifying the Unicode font to "fixed" will make most of the characters unavailable (i.e., shown as boxes). If instead your resource looks like

*VT100.font: fixed

it would be unambiguous, and not modify the utf8Fonts value.

I see question-marks instead of characters in uxterm

You may be seeing a question mark in a black diamond, like this:

That is called the Unicode replacement character. It is used when a program is told to display a character which is not in the Unicode system. The program replaces the illegal/invalid character with this symbol. That is different from boxes, which xterm displays when it has nothing in the current font for a valid Unicode character.

Unicode's rules are oriented toward handling input in different encodings, and displaying the corresponding Unicode value. Although Unicode has rules and a definition for the valid characters, different programs may handle invalid input in different ways. This page gives an overview of how xterm may differ from other programs in that regard.

The first popup menu is very slow

Some users report that when starting xterm, it is very slow, that their computer's CPU time increases, etc.

This is a longstanding bug in the X libraries. There is a workaround using a resource setting for xterm.

Details

XTerm uses the Athena (Xaw) widgets to display popup menus. In the normal case, those are initialized one-by-one as they are first used. If you have configured xterm to use its toolbar configuration, they are all initialized on startup. In the latter, performance problems are more noticeable.

The Athena widgets XawInitializeWidgetSet function goes through several levels down to the X library _XlcAddUtf8LocaleConverters function to call create_tocs_conv and related functions to make a list of character sets from the locale, which is used in menus to get all possible fonts needed for a fontset.

If your current locale uses UTF-8 encoding, this will read a long list of bitmap fonts—everything whose encoding might be useful for displaying the menus. For example, this list (from lcUTF8.c) which dates from around 2000 is the core of the problem:

ISO10646-1, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6, ISO8859-7, ISO8859-8, ISO8859-9, ISO8859-10, ISO8859-11, ISO8859-13, ISO8859-14, ISO8859-15, ISO8859-16, JISX0201.1976-0, TIS620-0, GB2312.1980-0, JISX0208.1983-0, JISX0208.1990-0, JISX0212.1990-0, KSC5601.1987-0, KOI8-R, KOI8-U, KOI8-C, TATAR-CYR, ARMSCII-8, IBM-CP1133, MULELAO-1, VISCII1.1-1, TCVN-5712, GEORGIAN-ACADEMY, GEORGIAN-PS, ISO8859-9E, MICROSOFT-CP1251, MICROSOFT-CP1255, MICROSOFT-CP1256, BIG5-0, BIG5-E0, BIG5-E1, ISO10646-1, ISO10646-1

However, xterm is going to use only the characters shown in the popup menus. It is unlikely that you need Chinese fonts for that.

Solution

XTerm's menuLocale resource can be set to an explicit value, e.g., "C" to override the current locale as seen by this initialization debacle.

Limitations

The workaround does not prevent some hacker from "improving" the X libraries still further.

Keyboard problems

Why can't I input 8-bit characters?

You must have the eightBitInput resource set to do this.

Why doesn't my delete key work?

This seems to have begun as a problem with the older XFree86 release (3.1.2). I have picked up pieces of the story (xterm and the keyboard work as designed under XFree86 3.2 and up).

The underlying problem is that we've accumulated three things that are being equated as "Delete":

ASCII BS (backspace, code 8)
ASCII DEL (delete. code 127)
VT220 "remove" aka "delete" (ESC [ 3 ~)

You are probably talking about the backarrow key (on my keyboard, at the upper right of the QWERTY block), or the key labeled delete which is on the 6-key "editing keypad". Since xterm is emulating a VT100/VT220, the backarrow key should generate a 127 (often displayed as ^?). You would use a control/H to obtain a backspace on a real VT220.

The reason why BS and DEL are of special interest is that on Unix, the stty command and the underlying termios/termio system calls allow only single-byte codes to be assigned to special functions such as erase. For instance, you could see something like this on your terminal:

$ stty -a
speed 38400 baud; rows 40; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>; susp = <undef>;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt
-echoctl -echoke

Tastes differ. On Unix, people expect the backarrow key to generate a backspace (or not). As I understand it, at one point, XFree86 picked up the sense of the erase character during initialization, so that xterm would in effect use the same erase character as the console. The current scheme (X11R6) uses keyboard mapping tables that are independent of the environment.

Modern xterm (since patch #83 in 1998) provides a resource toggle backarrowKey (and an escape sequence from VT320) that changes this key between the two styles (backspace or delete).

With modern xterm patch 95 (also in the stable version as "88c"), you may have an xterm which can automatically initialize the backarrow key to backspace or delete depending on the pseudo terminal's sense, o