ascii 2.7 KB

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