Backslash escapes

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{FormatInfo |formattype=electronic |subcat=Character encoding |wikidata={{wikidata|Q1366300}}, {{wikidata|Q17077094}} }} '''Backslash escapes''' are one of the methods variou...")

Revision as of 03:42, 28 June 2019

File Format
Name Backslash escapes
Wikidata ID Q1366300, Q17077094

Backslash escapes are one of the methods various programming, scripting, and markup languages use to allow the inclusion of characters in text strings that might otherwise be difficult or impossible to use, because they have special syntactic meaning, are not part of the currently-used character set, are difficult to type, or are nonprinting characters that don't show in a display. These were introduced in the C programming language, but some version of them is in use in a number of other languages and formats.

These are the standard C backspace escapes:

Escape sequence Meaning
\a Alert/beep/bell (BEL, 07)
\b Backspace (BS, 08)
\f Formfeed (FF, 0C)
\n Newline/Linefeed (LF, 0A)
\r Carriage Return (CR, 0D)
\t Horizontal Tab (HT, 09)
\v Vertical Tab (VT, 0B)
\\ Backslash (\, 5C)
\' Apostrophe/single-quote (', 27)
\" Double quote (", 22)
\? Question mark (?, 3F)
\nnn Byte specified as octal number
\xhh Byte specified as hexadecimal number
\uhhhh Unicode character (range 0000-FFFF)
\Uhhhhhhhh Unicode character (full range)

Some additions and variations may be used in different systems. Often \e stands for the escape character (ESC, 1B), though this is not one of the official standard C escapes. The newline (\n) might get translated to a system-specific line break sequence such as CR or CR+LF.


Personal tools