ESPTerm implements Alternate Character Sets as a way to print box drawing characters and special symbols. A character set can change what each received ASCII character is printed as on the screen (eg. "{" is "π" in codepage `0`). The implementation is based on the original VT devices.
Since ESPTerm also supports UTF-8, this feature is the most useful for applications which can't print UTF-8 or already use alternate character sets for historical reasons.
All codepages use codes 32-127, 32 being space. A character with no entry in the active codepage stays unchanged.
$cp) { echo "There are two character set slots, G0 and G1. Those slots are selected as active using ASCII codes Shift In and Shift Out (those originally served for shifting a red-black typewriter tape). Often only G0 is used for simplicity.
Each slot (G0 and G1) can have a different codepage assigned. G0 and G1 and the active slot number are
saved and restored with the cursor and cleared with a screen reset (\ec
).
The following commands are used:
Code | Meaning |
---|---|
`\e(x` | Set G0 = codepage x |
`\e)x` | Set G1 = codepage x |
_SO_ (14) | Activate G0 |
_SI_ (15) | Activate G1 |