《编程导论(Java)·1.2.3 五种Java元素》中提到:
Java支持Unicode字符集(Unicode character set)。它以16位来表示一个字符,其中最前的128个字符则是ASCII( The American StandardCode form Information Interchange)码字符。
Java中的标识符、注释、字符文字、字符串文字可以使用Unicode,而关键字、操作符等其他Java元素则使用ASCII中的(一些)字符。
代码库codes中的相关代码
package tips; import static tips.Print.*; /** *ASCII字符 * @author yqj2065 * @version 2011.10 */ public class Ascii{ //打印Ascii,其中不可打印字符,自然看不见。 public static void plintAscii(){ for(byte i =0;i< 128 && i>=0;i++){ System.out.println(i+" "+ (char)i); } } /** * Unicode字符集(Unicode character set),以16位来表示一个字符, * 其中最前的128个字符则是ASCII. * 测试参数:48、65、97、130、258、20005 * 将形参改为byte,测试[0,127]数据! */ public static void testUnicode(int i){ //int[] data = {}; pln(i+" "+ (char)i); } }
ASCII and Latin-1 Character Table | |||||
---|---|---|---|---|---|
Char | Dec | Hex | Octal | HTML | Notes |
^@ | 0 | 0x00 | 0000 | ^@ | NUL nul |
^A | 1 | 0x01 | 0001 | ^A | SOH start of header |
^B | 2 | 0x02 | 0002 | ^B | STX start of text |
^C | 3 | 0x03 | 0003 | ^C | ETX end of text |
^D | 4 | 0x04 | 0004 | ^D | EOT end of transmission |
^E | 5 | 0x05 | 0005 | ^E | ENQ enquiry |
^F | 6 | 0x06 | 0006 | ^F | ACK acknowledege |
^G | 7 | 0x07 | 0007 | ^G | BEL bell |
^H | 8 | 0x08 | 0010 | ^H | BS backspace [/b] |
^I | 9 | 0x09 | 0011 | ^I | HT horizonal tab [/t] |
^J | 10 | 0x0a | 0012 | ^J | LF line feed [/n] |
^K | 11 | 0x0b | 0013 | ^K | VT vertical tab |
^L | 12 | 0x0c | 0014 | ^L | FF form feed [/f] |
^M | 13 | 0x0d | 0015 | ^M | CR carriage return [/r] |
^N | 14 | 0x0e | 0016 | ^N | SO shift out |
^O | 15 | 0x0f | 0017 | ^O | SI shift in |
^P | 16 | 0x10 | 0020 | ^P | DLE data link escape |
^Q | 17 | 0x11 | 0021 | ^Q | DC1 device control 1, XON resume transmission |
^R | 18 | 0x12 | 0022 | ^R | DC2 device control 2 |
^S | 19 | 0x13 | 0023 | ^S | DC3 device control 3, XOFF pause transmission |
^T | 20 | 0x14 | 0024 | ^T | DC4 device control 4 |
^U | 21 | 0x15 | 0025 | ^U | NAK negative acknowledge |
^V | 22 | 0x16 | 0026 | ^V | SYN synchronise |
^W | 23 | 0x17 | 0027 | ^W | ETB end text block |
^X | 24 | 0x18 | 0030 | ^X | CAN cancel |
^Y | 25 | 0x19 | 0031 | ^Y | EM end message |
^Z | 26 | 0x1a | 0032 | ^Z | SUB substitute |
^[ | 27 | 0x1b | 0033 | ^[ | ESC escape |
^/ | 28 | 0x1c | 0034 | ^/ | FS file separator, usually used to separate groups of records. |
^] | 29 | 0x1d | 0035 | ^] | GS group separator, usually used to separate fields. |
^^ | 30 | 0x1e | 0036 | ^^ | RS record separator, usually used to separate records. |
^_ | 31 | 0x1f | 0037 | ^_ | US unit separator, usually used to separate subfields. |
32 | 0x20 | 0040 | | space | |
! | 33 | 0x21 | 0041 | ! | bang, exclamation |
" | 34 | 0x22 | 0042 | " | quote |
# | 35 | 0x23 | 0043 | # | sharp, number sign |
$ | 36 | 0x24 | 0044 | $ | dollar sign |
% | 37 | 0x25 | 0045 | % | percent |
& | 38 | 0x26 | 0046 | & | ampersand |
' | 39 | 0x27 | 0047 | ' | apostrophe |
( | 40 | 0x28 | 0050 | ( | left parenthesis |
) | 41 | 0x29 | 0051 | ) | right parenthesis |
* | 42 | 0x2a | 0052 | * | star, asterisk |
+ | 43 | 0x2b | 0053 | + | plus |
, | 44 | 0x2c | 0054 | , | comma |
- | 45 | 0x2d | 0055 | - | minus |
. | 46 | 0x2e | 0056 | . | period |
/ | 47 | 0x2f | 0057 | / | slash, not backslash! |
0 | 48 | 0x30 | 0060 | 0 | digit 0 |
1 | 49 | 0x31 | 0061 | 1 | digit 1 |
2 | 50 | 0x32 | 0062 | 2 | digit 2 |
3 | 51 | 0x33 | 0063 | 3 | digit 3 |
4 | 52 | 0x34 | 0064 | 4 | digit 4 |
5 | 53 | 0x35 | 0065 | 5 | digit 5 |
6 | 54 | 0x36 | 0066 | 6 | digit 6 |
7 | 55 | 0x37 | 0067 | 7 | digit 7 |
8 | 56 | 0x38 | 0070 | 8 | digit 8 |
9 | 57 | 0x39 | 0071 | 9 | digit 9 |
: | 58 | 0x3a | 0072 | : | colon |
; | 59 | 0x3b | 0073 | ; | semicolon |
< | 60 | 0x3c | 0074 | < | less than |
= | 61 | 0x3d | 0075 | = | equals |
> | 62 | 0x3e | 0076 | > | greater than |
? | 63 | 0x3f | 0077 | ? | question mark |
@ | 64 | 0x40 | 0100 | @ | at sign |
A | 65 | 0x41 | 0101 | A | upper case A |
B | 66 | 0x42 | 0102 | B | upper case B |
C | 67 | 0x43 | 0103 | C | upper case C |
D | 68 | 0x44 | 0104 | D | upper case D |
E | 69 | 0x45 | 0105 | E | upper case E |
F | 70 | 0x46 | 0106 | F | upper case F |
G | 71 | 0x47 | 0107 | G | upper case G |
H | 72 | 0x48 | 0110 | H | upper case H |
I | 73 | 0x49 | 0111 | I | upper case I |
J | 74 | 0x4a | 0112 | J | upper case J |
K | 75 | 0x4b | 0113 | K | upper case K |
L | 76 | 0x4c | 0114 | L | upper case L |
M | 77 | 0x4d | 0115 | M | upper case M |
N | 78 | 0x4e | 0116 | N | upper case N |
O | 79 | 0x4f | 0117 | O | upper case O |
P | 80 | 0x50 | 0120 | P | upper case P |
Q | 81 | 0x51 | 0121 | Q | upper case Q |
R | 82 | 0x52 | 0122 | R | upper case R |
S | 83 | 0x53 | 0123 | S | upper case S |
T | 84 | 0x54 | 0124 | T | upper case T |
U | 85 | 0x55 | 0125 | U | upper case U |
V | 86 | 0x56 | 0126 | V | upper case V |
W | 87 | 0x57 | 0127 | W | upper case W |
X | 88 | 0x58 | 0130 | X | upper case X |
Y | 89 | 0x59 | 0131 | Y | upper case Y |
Z | 90 | 0x5a | 0132 | Z | upper case Z |
[ | 91 | 0x5b | 0133 | [ | left square bracket |
/ | 92 | 0x5c | 0134 | / | backslash, not slash! |
] | 93 | 0x5d | 0135 | ] | right square bracket |
^ | 94 | 0x5e | 0136 | ^ | hat, circumflex |
_ | 95 | 0x5f | 0137 | _ | underscore |
` | 96 | 0x60 | 0140 | ` | grave, rhymes with have |
a | 97 | 0x61 | 0141 | a | lower case a |
b | 98 | 0x62 | 0142 | b | lower case b |
c | 99 | 0x63 | 0143 | c | lower case c |
d | 100 | 0x64 | 0144 | d | lower case d |
e | 101 | 0x65 | 0145 | e | lower case e |
f | 102 | 0x66 | 0146 | f | lower case f |
g | 103 | 0x67 | 0147 | g | lower case g |
h | 104 | 0x68 | 0150 | h | lower case h |
i | 105 | 0x69 | 0151 | i | lower case i |
j | 106 | 0x6a | 0152 | j | lower case j |
k | 107 | 0x6b | 0153 | k | lower case k |
l | 108 | 0x6c | 0154 | l | lower case l |
m | 109 | 0x6d | 0155 | m | lower case m |
n | 110 | 0x6e | 0156 | n | lower case n |
o | 111 | 0x6f | 0157 | o | lower case o |
p | 112 | 0x70 | 0160 | p | lower case p |
q | 113 | 0x71 | 0161 | q | lower case q |
r | 114 | 0x72 | 0162 | r | lower case r |
s | 115 | 0x73 | 0163 | s | lower case s |
t | 116 | 0x74 | 0164 | t | lower case t |
u | 117 | 0x75 | 0165 | u | lower case u |
v | 118 | 0x76 | 0166 | v | lower case v |
w | 119 | 0x77 | 0167 | w | lower case w |
x | 120 | 0x78 | 0170 | x | lower case x |
y | 121 | 0x79 | 0171 | y | lower case y |
z | 122 | 0x7a | 0172 | z | lower case z |
{ | 123 | 0x7b | 0173 | { | left curly brace |
| | 124 | 0x7c | 0174 | | | vertical bar |
} | 125 | 0x7d | 0175 | } | right curly brace |
~ | 126 | 0x7e | 0176 | ~ | tilde |
| 127 | 0x7f | 0177 |  | DEL delete |
€ | 128 | 0x80 | 0200 | € | |
| 129 | 0x81 | 0201 |  | |
‚ | 130 | 0x82 | 0202 | ‚ | |
ƒ | 131 | 0x83 | 0203 | ƒ | |
„ | 132 | 0x84 | 0204 | „ | |
… | 133 | 0x85 | 0205 | … | |
† | 134 | 0x86 | 0206 | † | |
‡ | 135 | 0x87 | 0207 | ‡ | |
ˆ | 136 | 0x88 | 0210 | ˆ | |
‰ | 137 | 0x89 | 0211 | ‰ | |
Š | 138 | 0x8a | 0212 | Š | |
‹ | 139 | 0x8b | 0213 | ‹ | |
Œ | 140 | 0x8c | 0214 | Œ | |
| 141 | 0x8d | 0215 |  | |
Ž | 142 | 0x8e | 0216 | Ž | |
| 143 | 0x8f | 0217 |  | |
| 144 | 0x90 | 0220 |  | |
‘ | 145 | 0x91 | 0221 | ‘ | |
’ | 146 | 0x92 | 0222 | ’ | |
“ | 147 | 0x93 | 0223 | “ | |
” | 148 | 0x94 | 0224 | ” | |
• | 149 | 0x95 | 0225 | • | |
– | 150 | 0x96 | 0226 | – | |
— | 151 | 0x97 | 0227 | — | |
˜ | 152 | 0x98 | 0230 | ˜ | |
™ | 153 | 0x99 | 0231 | ™ | |
š | 154 | 0x9a | 0232 | š | |
› | 155 | 0x9b | 0233 | › | |
œ | 156 | 0x9c | 0234 | œ | |
| 157 | 0x9d | 0235 |  | |
ž | 158 | 0x9e | 0236 | ž | |
Ÿ | 159 | 0x9f | 0237 | Ÿ | |
160 | 0xa0 | 0240 |   | ||
¡ | 161 | 0xa1 | 0241 | ¡ | PostScript (¡) exclamdown |
¢ | 162 | 0xa2 | 0242 | ¢ | PostScript (¢) cent |
£ | 163 | 0xa3 | 0243 | £ | PostScript (£) sterling |
¤ | 164 | 0xa4 | 0244 | ¤ | PostScript (/) fraction |
¥ | 165 | 0xa5 | 0245 | ¥ | PostScript (¥) yen |
¦ | 166 | 0xa6 | 0246 | ¦ | PostScript (ƒ) florin |
§ | 167 | 0xa7 | 0247 | § | PostScript (§) section |
¨ | 168 | 0xa8 | 0250 | ¨ | PostScript (¤) currency |
© | 169 | 0xa9 | 0251 | © | PostScript (') quotesingle |
ª | 170 | 0xaa | 0252 | ª | PostScript (“) quotedblleft |
« | 171 | 0xab | 0253 | « | PostScript («) guillemotleft |
¬ | 172 | 0xac | 0254 | ¬ | PostScript (<) guilsinglleft |
| 173 | 0xad | 0255 | ­ | PostScript (>) guilsinglright |
® | 174 | 0xae | 0256 | ® | PostScript fi ligature |
¯ | 175 | 0xaf | 0257 | ¯ | PostScript fl ligature; |
° | 176 | 0xb0 | 0260 | ° | |
± | 177 | 0xb1 | 0261 | ± | PostScript (–) endash |
² | 178 | 0xb2 | 0262 | ² | PostScript (†) dagger |
³ | 179 | 0xb3 | 0263 | ³ | PostScript (·) periodcentered |
´ | 180 | 0xb4 | 0264 | ´ | |
µ | 181 | 0xb5 | 0265 | µ | |
¶ | 182 | 0xb6 | 0266 | ¶ | PostScript (¶) paragraph |
· | 183 | 0xb7 | 0267 | · | PostScript (•) bullet |
¸ | 184 | 0xb8 | 0270 | ¸ | PostScript (,) quotesinglbase |
¹ | 185 | 0xb9 | 0271 | ¹ | PostScript („) quotedblbase |
º | 186 | 0xba | 0272 | º | PostScript (”) quotedblright |
» | 187 | 0xbb | 0273 | » | PostScript (») guillemotright |
¼ | 188 | 0xbc | 0274 | ¼ | PostScript (…) ellipsis |
½ | 189 | 0xbd | 0275 | ½ | PostScript (‰) perthousand |
¾ | 190 | 0xbe | 0276 | ¾ | |
¿ | 191 | 0xbf | 0277 | ¿ | PostScript (¿) questiondown |
À | 192 | 0xc0 | 0300 | À | |
Á | 193 | 0xc1 | 0301 | Á | PostScript (`) grave |
 | 194 | 0xc2 | 0302 |  | PostScript (´) acute |
à | 195 | 0xc3 | 0303 | à | PostScript (^) circumflex |
Ä | 196 | 0xc4 | 0304 | Ä | PostScript (~) tilde |
Å | 197 | 0xc5 | 0305 | Å | PostScript (¯) macron, overbar accent |
Æ | 198 | 0xc6 | 0306 | Æ | PostScript (u) breve, flattened u-shaped accent |
Ç | 199 | 0xc7 | 0307 | Ç | PostScript (·) dotaccent |
È | 200 | 0xc8 | 0310 | È | PostScript (¨) dieresis |
É | 201 | 0xc9 | 0311 | É | |
Ê | 202 | 0xca | 0312 | Ê | PostScript (°) ring |
Ë | 203 | 0xcb | 0313 | Ë | PostScript (¸) cedilla |
Ì | 204 | 0xcc | 0314 | Ì | |
Í | 205 | 0xcd | 0315 | Í | PostScript (”) hungarumlaut |
Î | 206 | 0xce | 0316 | Î | PostScript (,) ogonek, reverse comma |
Ï | 207 | 0xcf | 0317 | Ï | PostScript (v) caron, flattened v-shaped accent |
Ð | 208 | 0xd0 | 0320 | Ð | PostScript (—) emdash |
Ñ | 209 | 0xd1 | 0321 | Ñ | |
Ò | 210 | 0xd2 | 0322 | Ò | |
Ó | 211 | 0xd3 | 0323 | Ó | |
Ô | 212 | 0xd4 | 0324 | Ô | |
Õ | 213 | 0xd5 | 0325 | Õ | |
Ö | 214 | 0xd6 | 0326 | Ö | |
× | 215 | 0xd7 | 0327 | × | |
Ø | 216 | 0xd8 | 0330 | Ø | |
Ù | 217 | 0xd9 | 0331 | Ù | |
Ú | 218 | 0xda | 0332 | Ú | |
Û | 219 | 0xdb | 0333 | Û | |
Ü | 220 | 0xdc | 0334 | Ü | |
Ý | 221 | 0xdd | 0335 | Ý | |
Þ | 222 | 0xde | 0336 | Þ | |
ß | 223 | 0xdf | 0337 | ß | |
à | 224 | 0xe0 | 0340 | à | |
á | 225 | 0xe1 | 0341 | á | PostScript (Æ) AE |
â | 226 | 0xe2 | 0342 | â | |
ã | 227 | 0xe3 | 0343 | ã | PostScript (ª) ordfeminine |
ä | 228 | 0xe4 | 0344 | ä | |
å | 229 | 0xe5 | 0345 | å | |
æ | 230 | 0xe6 | 0346 | æ | |
ç | 231 | 0xe7 | 0347 | ç | |
è | 232 | 0xe8 | 0350 | è | PostScript (L/) Lslash, L with / overstrike |
é | 233 | 0xe9 | 0351 | é | PostScript (Ø) Oslash |
ê | 234 | 0xea | 0352 | ê | PostScript (Œ) OE |
ë | 235 | 0xeb | 0353 | ë | PostScript (º) ordmasculine |
ì | 236 | 0xec | 0354 | ì | |
í | 237 | 0xed | 0355 | í | |
î | 238 | 0xee | 0356 | î | |
ï | 239 | 0xef | 0357 | ï | |
ð | 240 | 0xf0 | 0360 | ð | |
ñ | 241 | 0xf1 | 0361 | ñ | PostScript (æ) ae |
ò | 242 | 0xf2 | 0362 | ò | |
ó | 243 | 0xf3 | 0363 | ó | |
ô | 244 | 0xf4 | 0364 | ô | |
õ | 245 | 0xf5 | 0365 | õ | PostScript (1) dotlessi, i without dot |
ö | 246 | 0xf6 | 0366 | ö | |
÷ | 247 | 0xf7 | 0367 | ÷ | |
ø | 248 | 0xf8 | 0370 | ø | PostScript (l/) l with / overstrike |
ù | 249 | 0xf9 | 0371 | ù | PostScript (ø) oslash |
ú | 250 | 0xfa | 0372 | ú | PostScript (œ) oe |
û | 251 | 0xfb | 0373 | û | PostScript (ß) germandbls |
ü | 252 | 0xfc | 0374 | ü | |
ý | 253 | 0xfd | 0375 | ý | |
þ | 254 | 0xfe | 0376 | þ | |
ÿ | 255 | 0xff | 0377 | ÿ |