Awesome Open Source
Awesome Open Source

Build Node Twitter Medium

All the characters that work on most terminals.

Background

While ASCII characters display correctly on all terminals, this is not the case of all characters. When building a terminal application or tool, it is common to experience cross-platform issues like:

The main reasons are:

  • The terminal font might not include this specific character.
  • The terminal encoding may not support Unicode. For example, Windows default terminal (Console Host) often use specific encodings like CP437, CP850 or Windows-1252.
  • The application might not be properly converting encodings when reading or writing terminal characters.

The first two points can be solved by using characters known to display correctly on most terminals and environments. This repository contains a list of those characters:

Terminals

This was tested on the following terminals, with their default font and encoding.

  • Ubuntu 20.10:
    • Gnome VTE:
      • Gnome terminal 3.38.0
      • XFCE terminal 0.8.9.2
      • Guake terminal 3.6.3
      • tilix 1.9.3
      • terminator 1.92
    • xterm 353
    • konsole 20.08.2
    • rxvt 9.22
    • PuTTY 0.74
    • xterm.js:
      • VSCode terminal 1.54.3
      • hyper 3.0.2
    • Linux console (kernel)
  • macOS 10.14:
    • terminal.app 2.9
    • iTerm2 3.4.4
    • Alacritty 0.7.2
  • Windows 10.0.17763:
    • Console Host (CP850):
      • cmd.exe
      • Powershell 5.1
    • mintty, Git-for-Windows 2.31.1
    • ConEmu 201314
    • cmder 1.3.18
    • Fluent terminal 0.7.5.0
    • Terminus 1.0.135

This does not cover:

  • EBCDIC
  • Exotic custom fonts
  • Other locales than en_US for the following terminals: Linux console (kernel)

List of characters

The following characters work on most terminals.

When the character is displayed, its Unicode codepoint is shown above it.

Control characters and spaces

000a Line feed          (some behavior is OS-specific)
000d Carriage return    (some behavior is OS-specific)
0009 Horizontal tab
0008 Backspace          (some behavior is terminal-specific)
001b Escape
0020 Space
00a0 Non-breaking space

Latin alphabet

0041 0042 0043 0044 0045 0046
A    B    C    D    E    F
0047 0048 0049 004a 004b 004c
G    H    I    J    K    L
004d 004e 004f 0050 0051 0052
M    N    O    P    Q    R
0053 0054 0055 0056 0057 0058
S    T    U    V    W    X
0059 005a
Y    Z

0061 0062 0063 0064 0065 0066
a    b    c    d    e    f
0067 0068 0069 006a 006b 006c
g    h    i    j    k    l
006d 006e 006f 0070 0071 0072
m    n    o    p    q    r
0073 0074 0075 0076 0077 0078
s    t    u    v    w    x
0079 007a
y    z

00c0 00e0 00c1 00e1 00c2 00e2
                    
00c3 00e3 00c4 00e4 00c5 00e5
                    
0100 0101 0102 0103 0104 0105
                    
00c6 00e6
    
1e02 1e03
    
00c7 00e7 0106 0107 0108 0109
                    
010a 010b 010c 010d
            
010e 010f 00d0 0110 00f0 0111
                    
1e0a 1e0b
    
00c8 00e8 00c9 00e9 00ca 00ea
                    
00cb 00eb 0112 0113 0116 0117
                    
0118 0119 011a 011b
            
0192 1e1e 1e1f
        
011c 011d 011e 011f 0120 0121
                    
0122 0123
    
0124 0125 0126 0127
            
00cc 00ec 00cd 00ed 00ce 00ee
                    
00cf 00ef 012a 012b 012e 012f
                    
0130 0131
    
0134 0135
    
0136 0137
    
0139 013a 013b 013c 013d 013e
                    
0141 0142
    
1e40 1e41
    
00d1 00f1 0143 0144 0145 0146
                    
0147 0148
    
00d2 00f2 00d3 00f3 00d4 00f4
                    
00d5 00f5 00d6 00f6 014c 014d
                    
0150 0151 0152 0153 00d8 00f8
                    
1e56 1e57
    
0154 0155 0156 0157 0158 0159
                    
015a 015b 015c 015d 015e 0218
                    
015f 0219 0160 0161 1e60 1e61
                    
0162 021a 0163 021b 0164 0165
                    
1e6a 1e6b
    
00d9 00f9 00da 00fa 00db 00fb
                    
00dc 00fc 016a 016b 016c 016d
                    
016e 016f 0170 0171 0172 0173
                    
0174 0175 1e80 1e81 1e82 1e83
                    
1e84 1e85
    
00dd 00fd 0176 0177 0178 00ff
                    
1ef2 1ef3
    
0179 017a 017b 017c 017d 017e
                    
00de 00fe
    
00df

Greek alphabet

0391 0392 0393 0394 0395 0396
                    
03b1 03b2 03b3 03b4 03b5 03b6
                    
0397 0398 03f4 0399 039a 039b
                    
03b7 03b8      03b9 03ba 03bb
                     
039c      039d 039e 039f 03a0
                     
00b5 03bc 03bd 03be 03bf 03c0
                    
03a1 03a3      03a4 03a5 03a6
                     
03c1 03c2 03c3 03c4 03c5 03c6
                    
03a7 03a8 03a9
        
03c7 03c8 03c9 03f3
            

0386 0388 0389 038a 03aa 038c
                    
038e 03ab 038f 03ac 03ad 03ae
                    
03af 03ca 0390 03cc 03cd 03b0
                    
03cb 03ce 0384 0385
            

Cyrillic alphabet

0402 0403 0404 0405 0406 0407
                    
0408 0409 040a 040b 040c 040d
                    
040e 040f 0410 0411 0412 0413
                    
0414 0415 0416 0417 0418 0419
                    
041a 041b 041c 041d 041e 041f
                    
0420 0421 0422 0423 0424 0425
                    
0426 0427 0428 0429 042a 042b
                    
042c 042d 042e 042f 0430 0431
                    
0432 0433 0434 0435 0436 0437
                    
0438 0439 043a 043b 043c 043d
                    
043e 043f 0440 0441 0442 0443
                    
0444 0445 0446 0447 0448 0449
                    
044a 044b 044c 044d 044e 044f
                    
0450 0451 0452 0453 0454 0455
                    
0456 0457 0458 0459 045a 045b
                    
045c 045d 045e 045f 0490 0491
                    
04ae 04d0 04d1
        

Numbers

0030 0031 0032 0033 0034 0035
0    1    2    3    4    5
0036 0037 0038 0039
6    7    8    9

24ea 2460 2461 2462 2463 2464
                  
2465 2466 2467 2468
          

00ba 00b9 00b2 00b3
            

0025 2030 00bc 00bd 00be
%                

Math

002b 002d 002a 002f 00b1
+    -    *    /    
003d 2260 2248 2261
=            
003c 003e 2264 2265
<    >        

00d7 00f7 00ac 2310 2229
                
221a 221e 2206 2320 2321
                
2126 00b0 00aa 207f
            

Punctuation

0021 00a1 203c 003f 00bf
!            ?    
002c 002e 2026 003a 003b
,    .        :    ;
0028 0029 005b 005d 007b 007d
(    )    [    ]    {    }

0022 0027 0060
"    '    `
2018 2019 201a 201c 201d 201e
                    
00ab 00bb 2039 203a
            

0026 007c 0023 0040 005c 005f
&    |    #    @    \    _
00a7 00b6
    

Accents

007e 005e 00a8 00af 00b4 00b8
~    ^                
02c6 02c7 02c9 02d8 02d9 02db
                    
02dc 02dd
    

Box drawing

2588 2592 2591 25a0
         

2500 2012 2014 2015 2501
                
2212 2013 2010
      

2502 2503 00a6
        

250c 250f 2510 2513
            
2514 2517 2518 251b
            
251c 2523 251d 2520
            
2524 252b 2525 2528
            
252c 2533 252f 2530
            
2534 253b 2537 2538
            
253c 254b 256c 253f 2542 256a
                    

Geometrical shapes

00b7 2219 2022 25cf 25ca
                
25b2 25bc 2190 2191 2192 2193
                    

Currency

0024 00a2 20ac 00a3 00a5 20a7
$                    
00a4

Other symbols

00a9 00ae 2122 2116 2020 2021
                    

Text file

The list is available in characters.txt. The file is UTF-8 encoded.

CLI

The following command prints the list of characters and their codepoints.

npx cross-platform-terminal-characters

API

A Node module is available to retrieve the list of characters above or detect non-cross-platform characters.

npm install cross-platform-terminal-characters
import {
  regex,
  codepoints,
  characters,
} from 'cross-platform-terminal-characters'

// false, i.e. cross-platform
console.log(regex.test(''))
// true, i.e. not cross-platform
console.log(regex.test(''))
// Remove not cross-platform characters, i.e. print `example  test  text`
console.log('example  test  text'.replace(regex, ''))

// Array of codepoint integers: [0x0008, 0x0009, ..., 0x25cf]
console.log(codepoints)
// Array of single-character strings: ['\b', '\t', ..., '']
console.log(characters)

This package is an ES module and must be loaded using an import or import() statement, not require().

See also

Support

For any question, don't hesitate to submit an issue on GitHub.

Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.

Contributing

This project was made with . The simplest way to give back is by starring and sharing it online.

If the documentation is unclear or has a typo, please click on the page's Edit button (pencil icon) and suggest a correction.

If you would like to help us fix an error or add more information, please check our guidelines. Pull requests are welcome!

Thanks go to these wonderful people:


ehmicky


Bayle Shanks


M Rule


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,540,398
Shell (230,739
Linux (16,197
Cli (15,131
Windows (9,505
Macos (8,707
Bash (6,873
Terminal (4,005
Cross Platform (3,253
Font (1,704
Operating System (1,607
Unix (1,586
Os (1,173
Unicode (848
Encoding (772
Ascii (572
Utf 8 (291
Related Projects