Hex Codes in Character Literals

If you need a place a character not normally available from the keyboard into a character literal, use the backslash to create the hex code for that character as shown in the following example:

'This string has an ASCII escape generated by hex 1B (\1B)'

The two characters immediately following a quoted backslash are treated as hex code provided they are either digits from 0 to 9 or letters from A (a) to F (f).

Any character string containing a hex code must be enclosed in quotation marks.

Note: The escape function of the backslash inside quoted character strings can be switched off with a SET ESCAPECHAR command.


Character literals that include hex codes can be useful for sending control codes to printers and terminals. For example, if the ASCII codes SI (hex 0F) and DC2 (hex 12) are used, respectively, to select and cancel condensed printing on your particular printer, use the following sequence of statements to print a report in the condensed mode:

set output printer   % switch serial output to printer
output '\0F';        % switch condensed print on
.... commands to generate report ....
output '\12'         % switch condensed print off
set output terminal  % switch output back to terminal