This post compares escape character in various systems: Java, C, and more…
Update Ongoing
This list will be updated.
Control
DES | DEC | HEX | C/C++ | C# | Java | Python | JSON |
---|---|---|---|---|---|---|---|
Alert (Bell, Beep) | 7 | 7 | \a |
\a |
\a |
||
Back Space | 8 | 8 | \b |
\b |
\b |
\b |
\b |
New Page (Form Feed) | 12 | C | \f |
\f |
\f |
\f |
\f |
New Line (Line Feed) | 10 | A | \n |
\n |
\n |
\n |
\n |
Ignore New Line | \<newline> |
||||||
Carriage Return | 13 | D | \r |
\r |
\r |
\r |
\r |
Horizontal Tab | 9 | 9 | \t |
\t |
\t |
\t |
\t |
Vertical Tab | 11 | B | \v |
\v |
\v |
- HTML represents all ASCII character with
&#ddd
whereddd
is the three-digit ASCII code in base-10. - For how to use the “Ignore New Line” in Python, see here.
- What does the bell do?
- What does the backspace do?
- What is CR, LF, FF?
Punctuations
DES | DEC | HEX | C/C++ | C# | Java | Python | JSON |
---|---|---|---|---|---|---|---|
\ |
48 | 30 | \\ |
\\ |
\\ |
\\ |
\\ |
/ |
92 | 5C | \/ |
||||
' |
39 | 27 | \' |
\' |
\' |
\' |
|
" |
34 | 22 | \" |
\" |
\" |
\" |
\" |
? |
63 | 3F | \? |
- Escape of special punctuations for Regex depends on implementation. See here.
Numerical value for character Reference
DES | C/C++/C# | Java | Python | JSON |
---|---|---|---|---|
octal | \ooo |
\ooo |
\ooo |
|
hexadecimal | \uhhhh \Uhhhhhhhh \xhh.. |
\uhhhh |
\uhhhh \Uhhhhhhhh \xhh \N{name} |
\uhhhh |
Null(� ) |
\0 |
\0 |
- How interpreters deals with exceeding digits (e.g.
\1004
) and a number that exceeds range (\xFFFFFFFFFF
) and even the range itself depends on implementation. - How octal/hexadecimal numbers are mapped to characters depends on language implementation.
\x
can be followed by any number of hexadecimal digits, and only stop when it meets the first non-dex digit.\0
=\00
=\000
= octal escape for null character.- What are octal/hexadecimal ASCII codes for?
- For a complete list of ASCII characters, see here; for UNICODE, see here; for UNICODE Name aliases, see here.
References
Buy me a cup of coffee?
- Post link: https://reimirno.github.io/2021/08/11/Different-Systems-of-Escape/
- Copyright Notice: All articles in this blog are licensed under unless otherwise stated.
GitHub Discussions