1
0

ascii 2.7 KB

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