9.2.5.3 Strings
Strings may be given in one of two formats.
- ASCII with the facility for special characters (for example, tab, carriage return, line feed) to be specified via escape sequences. ASCII strings must be enclosed in double quotes (”).
- Hexadecimal string, a stream of two-digit
hexadecimal values. Hexadecimal strings must be enclosed within square brackets ([ ]). Note: Each byte being transferred must be specified using two digits - for instance the byte value ‘2’ must be represented ‘02’.
In the case of an ASCII string, the following characters will be escaped:
Description | Characters |
---|---|
Horizontal Tab | \t |
Backslash |
\\ |
Double Quotes |
\" |
Carriage Return |
\r |
Linefeed |
\n |
Terminal Bell |
\a |
Backspace |
\b |
Vertical Tab |
\v |
Form feed |
\f |
Escape |
\e |
Examples:
- “hello” – ASCII string representation of hello
- “\r\nNew line” – ASCII string representation of <CR><LF>New line
- [68656c6c6f] – Hex string representation of hello
An empty string will be represented as either an empty ASCII string (””) or an empty hexadecimal string ([]). Both representations are valid and equivalent for input, for output only the ([]) form will be used.