ASCII(1) ASCII(1)
NAME
ascii(1,7) - report character aliases
SYNOPSIS
ascii(1,7) [-dxohv] [-t] [char-alias...]
OPTIONS
Called with no options, ascii(1,7) behaves like `ascii(1,7) -h'. Options are as
follows:
Script-friendly mode, emits only ISO/decimal/hex/octal/binary encodings of the character.
Parse multiple characters. Convenient way of parsing strings.
Ascii table in(1,8) decimal.
Ascii table in(1,8) hex.
Ascii table in(1,8) octal.
Show summary of options and a simple ASCII table.
Show version(1,3,5) of program.
DESCRIPTION
Characters in(1,8) the ASCII set(7,n,1 builtins) can have many aliases, depending on con-
text. A character's possible names include:
* Its bit pattern (binary representation).
* Its hex, decimal and octal representations.
* Its teletype mnemonic and caret-notation form (for control
chars).
* Its backlash-escape form in(1,8) C (for some control chars).
* Its printed form (for printables).
* Its full ISO official name in(1,8) English.
* Its ISO/ECMA code table reference.
* Its name as an HTML/SGML entity.
* Slang and other names in(1,8) wide use for it among hackers.
This utility accepts command-line strings and tries to interpret them
as one of the above. When it finds a value, it prints all of the names
of the character. The constructs in(1,8) the following list can be used to
specify character values. If an argument could be interpreted in(1,8) two or
more ways, names for all the different characters it might be are
dumped.
character
Any character not described by one of the following conventions
represents the character itself.
^character
A caret followed by a character.
\character
A backslash followed by certain special characters (abfnrtv).
mnemonic
An ASCII teletype mnemonic.
hexadecimal
A hexadecimal (hex) sequence consists of one or two case-insen-
sitive hex digit characters (01234567890abcdef). To ensure hex
interpretation use hexh, 0xhex, xhex or \xhex.
decimal
A decimal sequence consists of one, two or three decimal digit
characters (0123456789). To ensure decimal interpretation use
\0ddecimal, ddecimal, or \ddecimal.
octal An octal sequence consists of one, two or three octal digit
characters (01234567). To ensure octal interpretation use
\octal, 0ooctal, ooctal, or \ooctal.
bit pattern
A bit pattern (binary) sequence consists of one to eight binary
digit characters (01). To ensure bit interpretation use 0bbit
pattern, bbit pattern or \bbit pattern.
ISO/ECMA code
A ISO/ECMA code sequence consists of one or two decimal digit
characters, a slash, and one or two decimal digit characters.
name An official ASCII or slang name.
The slang names recognized and printed out are from a rather comprehen-
sive list that first appeared on USENET in(1,8) early 1990 and has been con-
tinuously updated since. Mnemonics recognized and printed include the
official ASCII set(7,n,1 builtins), some official ISO names (where those differ) and a
few common-use alternatives (such as NL for LF). HTML/SGML entity names
are also printed when applicable. All comparisons are case-insensitive,
and dashes are mapped to spaces. Any unrecognized arguments or out of
range values are silently ignored. Note that the -s option will not
recognize 'long' names, as it cannot differentiate them from other
parts of the string.
For correct results, be careful to stringize or quote shell metacharac-
ters in(1,8) arguments (especially backslash).
This utility is particularly handy for interpreting cc(1)'s ugly octal
`invalid-character' messages, or when coding anything to do with serial
communications. As a side effect it serves as a handy base-converter
for random(3,4,6) 8-bit values.
AUTHOR
Eric S. Raymond <esr@snark.thyrsus.com>; November 1990 (home page at :
http://www.catb.org/~esr/http://www.catb.org/~esr/). Reproduce, use,
and modify as you like as long as you don't remove this authorship
notice. Ioannis E. Tambouras <ioannis@debian.org> added command options
and minor enhancements. Brian J. Ginsbach <ginsbach@sgi.com> fixed sev-
eral bugs and expanded the man(1,5,7) page. David N. Welton <davidw@efn.org>
added the -s option. Matej Vela corrected the ISO names. Dave Capella
contributed the idea of listing HTML/SGML entities.
ASCII(1)