aboutsummaryrefslogtreecommitdiff
path: root/man/man1/ascii.1
blob: 99265f467d2fc83a38eb904180c58146294a7e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.TH ASCII 1 
.SH NAME
ascii, unicode \- interpret ASCII, Unicode characters
.SH SYNOPSIS
.B ascii
[
.B -8
]
[
.BI -oxdb n
]
[
.B -nct
]
[
.I text
]
.PP
.B unicode
[
.B -nt
]
.IB hexmin - hexmax
.PP
.B unicode
[
.B -t
]
.I hex
[
\&...
]
.PP
.B unicode
[
.B -n
]
.I characters
.PP
.B look
.I hex
.B \*9/lib/unicode
.SH DESCRIPTION
.I Ascii
prints the
.SM ASCII 
values corresponding to characters and
.I vice
.IR versa ;
under the
.B -8
option, the
.SM ISO
Latin-1 extensions (codes 0200-0377) are included.
The values are interpreted in a settable numeric base;
.B -o
specifies octal,
.B -d
decimal,
.B -x
hexadecimal (the default), and
.BI -b n
base
.IR n .
.PP
With no arguments,
.I ascii
prints a table of the character set in the specified base.
Characters of
.I text
are converted to their
.SM ASCII 
values, one per line. If, however, the first
.I text
argument is a valid number in the specified base, conversion
goes the opposite way.
Control characters are printed as two- or three-character mnemonics.
Other options are:
.TP
.B -n
Force numeric output.
.TP
.B -c
Force character output.
.TP
.B -t
Convert from numbers to running text; do not interpret
control characters or insert newlines.
.PP
.I Unicode
is similar; it converts between
.SM UTF
and character values from the Unicode Standard (see
.MR utf (7) ).
If given a range of hexadecimal numbers,
.I unicode
prints a table of the specified Unicode characters \(em their values and
.SM UTF
representations.
Otherwise it translates from
.SM UTF
to numeric value or vice versa,
depending on the appearance of the supplied text;
the
.B -n
option forces numeric output to avoid ambiguity with numeric characters.
If converting to
.SM UTF ,
the characters are printed one per line unless the
.B -t
flag is set, in which case the output is a single string
containing only the specified characters.
Unlike
.IR ascii ,
.I unicode
treats no characters specially.
.PP
The output of
.I ascii
and
.I unicode
may be unhelpful if the characters printed are not available in the current font.
.PP
The file
.B \*9/lib/unicode
contains a
table of characters and descriptions, sorted in hexadecimal order,
suitable for
.MR look (1)
on the lower case
.I hex
values of characters.
.SH EXAMPLES
.TP
.B "ascii -d"
Print the
.SM ASCII 
table base 10.
.TP
.B "unicode p"
Print the hex value of `p'.
.TP
.B "unicode 2200-22f1"
Print a table of miscellaneous mathematical symbols.
.TP
.B "look 039 \*9/lib/unicode"
See the start of the Greek alphabet's encoding in the Unicode Standard.
.SH FILES
.TP
.B \*9/lib/unicode
table of characters and descriptions.
.SH SOURCE
.B \*9/src/cmd/ascii.c
.br
.B \*9/src/cmd/unicode.c
.SH "SEE ALSO"
.MR look (1) ,
.MR tcs (1) ,
.MR utf (7) ,
.MR font (7)