ASCII
ASCII table
ASCII (an acronym for American Standard Code for Information Interchange) is a character encoding standard for electronic communication that uses just 128 code points (so 7b encoding).
| 0x0? | 0x1? | 0x2? | 0x3? | 0x4? | 0x5? | 0x6? | 0x7? | |
|---|---|---|---|---|---|---|---|---|
| 0x?0 | NUL |
DLE |
|
0 |
@ |
P |
` |
p |
| 0x?1 | SOH |
DC1 |
! |
1 |
A |
Q |
a |
q |
| 0x?2 | STX |
DC2 |
" |
2 |
B |
R |
b |
r |
| 0x?3 | ETX |
DC3 |
# |
3 |
C |
S |
c |
s |
| 0x?4 | EOT |
DC4 |
$ |
4 |
D |
T |
d |
t |
| 0x?5 | ENQ |
NAK |
% |
5 |
E |
U |
e |
u |
| 0x?6 | ACK |
SYN |
& |
6 |
F |
V |
f |
v |
| 0x?7 | BEL |
ETB |
' |
7 |
G |
W |
g |
w |
| 0x?8 | BS |
CAN |
( |
8 |
H |
X |
h |
x |
| 0x?9 | HT |
EM |
) |
9 |
I |
Y |
i |
y |
| 0x?A | LF |
SUB |
* |
: |
J |
Z |
j |
z |
| 0x?B | VT |
ESC |
+ |
; |
K |
[ |
k |
{ |
| 0x?C | FF |
FS |
, |
< |
L |
\ |
l |
| |
| 0x?D | CR |
GS |
- |
= |
M |
] |
m |
} |
| 0x?E | SO |
RS |
. |
> |
N |
^ |
n |
~ |
| 0x?F | SI |
US |
/ |
? |
P |
_ |
o |
DEL |
Easy to miss items:
- 0x20:
— space character - 0x27:
'— apostrophe - 0x60:
`— backtick (grave accent)
Bitwise masking
One might hit bit-wise masks used for a quick detection of characters class.
| Binary code mask | Masked group completeness | Hex range | Character class |
|---|---|---|---|
000x xxxx |
full | 0x00—0x1F | control characters |
0010 xxxx |
full | 0x20—0x2F | space or punctuation |
0011 xxxx |
partial | 0x30—0x39 | digits |
010x xxxx |
partial | 0x41—0x5A | capital letters |
011x xxxx |
partial | 0x61—0x7A | lowercase letters |
Control characters
Physical device control:
BEL— BELl (beep sound, alarm, warning, screen flashing)BS— BackSpaceHT— Horizontal TabLF— Line FeedVT— Vertical TabFF— Form FeedCR— Carriage ReturnDC1(akaXON) — Device Control 1DC2— Device Control 2DC3(akaXOFF) — Device Control 3DC4— Device Control 4
Logic communication control:
SOH— Start Of HeaderSTX— Start Of teXtETX— End Of teXtEOT— End Of TransmissionENQ— ENQuiryACK— ACKnowledgeDLE— Data Link EscapeNAK— Negative AcKnowledgeSYN— SYNchronous idleETB— End of Transmission Block
Physical communication control:
NUL— NULl (used as string terminating character of C language)CAN— CANcelEM— End of MediumSUB— SUBstituteDEL— DELete
Information separators:
FS— File SeparatorGS— Group SeparatorRS— Record SeparatorUS— Unit Separator
Code extension:
SO— Shift OutSI— Shift InESC— ESCape
| Control character | Caret notation | C string escaped characters |
|---|---|---|
NUL |
^@ |
\0 |
SOH |
^A |
|
STX |
^B |
|
ETX |
^C |
|
EOT |
^D |
|
ENQ |
^E |
|
ACK |
^F |
|
BEL |
^G |
\a |
BS |
^H |
\b |
HT |
^I |
\t |
LF |
^J |
\n |
VT |
^K |
\v |
FF |
^L |
\f |
CR |
^M |
\r |
SO |
^N |
|
SI |
^P |
|
DLE |
^P |
|
DC1 |
^Q |
|
DC2 |
^R |
|
DC3 |
^S |
|
DC4 |
^T |
|
NAK |
^U |
|
SYN |
^V |
|
ETB |
^W |
|
CAN |
^X |
|
EM |
^Y |
|
SUB |
^Z |
|
ESC |
^[ |
\e |
FS |
^\ |
|
GS |
^] |
|
RS |
^^ |
|
US |
^_ |
|
DEL |
^? |
Extra round: ITU Morse code and ICAO phonetic alphabet
Not the same topic, but a nice place to show that some
| Letter | International (ITU) Morse code | ICAO/NATO phonetic alphabet |
|---|---|---|
| A | · — | Alpha (AL-FAH) |
| B | — · · · | Bravo (BRAH-VOH) |
| C | — · — · | Charlie (CHAR-LEE or SHAR-LEE) |
| D | — · · | Delta (DELL-TAH) |
| E | · | Echo (ECK-OH) |
| F | · · — · | Foxtrot (FOKS-TROT) |
| G | — — · | Golf (GOLF) |
| H | · · · · | Hotel (HOH-TEL) |
| I | · · | India (IN-DEE-AH) |
| J | · — — — | Juliet (JEW-LEE-ETT) |
| K | — · — | Kilo (KEY-LOH) |
| L | · — · · | Lima (LEE-MAH) |
| M | — — | Mike (MIKE) |
| N | — · | November (NO-VEM-BER) |
| O | — — — | Oscar (OSS-CAH) |
| P | · — — · | Papa (PAH-PAH) |
| Q | — — · — | Quebec (KEH-BECK) |
| R | · — · | Romeo (ROW-ME-OH) |
| S | · · · | Sierra (SEE-AIR-RAH) |
| T | — | Tango (TANG-GO) |
| U | · · — | Uniform (YOU-NEE-FORM) |
| V | · · · — | Victor (VIK-TAH) |
| W | · — — | Whiskey (WISS-KEY) |
| X | — · · — | X-ray (ECKS-RAY) |
| Y | — · — — | Yankee (YANG-KEY) |
| Z | — — · · | Zulu (ZOO-LOO) |
| 0 | — — — — — | Zero (ZEE-RO) |
| 1 | · — — — — | One (WUN) |
| 2 | · · — — — | Two (TOO) |
| 3 | · · · — — | Three (TREE) |
| 4 | · · · · — | Four (FOW-ER) |
| 5 | · · · · · | Five (FIFE) |
| 6 | · · · — — | Six (SIX) |
| 7 | · · — — — | Seven (SEV-EN) |
| 8 | · — — — — | Eight (AIT) |
| 9 | — — — — — | Nine (NIN-ER) |