ACSII码对照表&java打印特殊字符

129 篇文章 0 订阅
1 篇文章 0 订阅
本文介绍了如何在Linux上查看ASCII对照表,并通过Java代码展示了如何使用八进制表示法打印ASCII特殊字符。内容包括ASCII码的介绍、在Linux上的查看方法、Java中使用八进制转义字符打印ASCII字符的示例。
摘要由CSDN通过智能技术生成

得到下面的ASCII对照表的方法:在Linux上面执行命令:man ascii

 

ASCII(7)                   Linux Programmer’s Manual                  ASCII(7)

 

NAME

       ascii - the ASCII character set encoded in octal, decimal, and hexadecimal

 

 

 

==============================================[start 2018-01-26 19:23]===============================================

2018-01-26 19:02,

    binary 二进制的

    octal 八进制的

    hexadecimal 十六进制的

    decimal 十进制的

 

 

    使用八进制(Oct)的表示方法:

        System.out.println("hello\001world"); // hello^Aworld

        System.out.println("hello\002world"); // hello^Bworld

        System.out.println("hello\011world"); // hello\tworld

 

==============================================[  end 2018-01-26 19:23]===============================================

 

 

 

DESCRIPTION

       ASCII is the American Standard Code for Information Interchange.  It is a 7-bit code.  Many 8-bit codes (such as

       ISO 8859-1, the Linux default character set) contain ASCII as their lower half.  The  international  counterpart

       of ASCII is known as ISO 646.

 

       The following table contains the 128 ASCII characters.

 

       C program '\X' escapes are noted.

 

       Oct   Dec   Hex   Char                        Oct   Dec   Hex   Char

       ------------------------------------------------------------------------

       000   0     00    NUL '\0'                    100   64    40    @

       001   1     01    SOH (start of heading)      101   65    41    A

       002   2     02    STX (start of text)         102   66    42    B

       003   3     03    ETX (end of text)           103   67    43    C

       004   4     04    EOT (end of transmission)   104   68    44    D

       005   5     05    ENQ (enquiry)               105   69    45    E

       006   6     06    ACK (acknowledge)           106   70    46    F

       007   7     07    BEL '\a' (bell)             107   71    47    G

       010   8     08    BS  '\b' (backspace)        110   72    48    H

       011   9     09    HT  '\t' (horizontal tab)   111   73    49    I

       012   10    0A    LF  '\n' (new line)         112   74    4A    J

       013   11    0B    VT  '\v' (vertical tab)     113   75    4B    K

       014   12    0C    FF  '\f' (form feed)        114   76    4C    L

       015   13    0D    CR  '\r' (carriage ret)     115   77    4D    M

       016   14    0E    SO  (shift out)             116   78    4E    N

       017   15    0F    SI  (shift in)              117   79    4F    O

       020   16    10    DLE (data link escape)      120   80    50    P

       021   17    11    DC1 (device control 1)      121   81    51    Q

       022   18    12    DC2 (device control 2)      122   82    52    R

       023   19    13    DC3 (device control 3)      123   83    53    S

       024   20    14    DC4 (device control 4)      124   84    54    T

       025   21    15    NAK (negative ack.)         125   85    55    U

       026   22    16    SYN (synchronous idle)      126   86    56    V

       027   23    17    ETB (end of trans. blk)     127   87    57    W

       030   24    18    CAN (cancel)                130   88    58    X

       031   25    19    EM  (end of medium)         131   89    59    Y

       032   26    1A    SUB (substitute)            132   90    5A    Z

       033   27    1B    ESC (escape)                133   91    5B    [

       034   28    1C    FS  (file separator)        134   92    5C    \  '\\'

       035   29    1D    GS  (group separator)       135   93    5D    ]

       036   30    1E    RS  (record separator)      136   94    5E    ^

       037   31    1F    US  (unit separator)        137   95    5F    _

       040   32    20    SPACE                       140   96    60    `

       041   33    21    !                           141   97    61    a

       042   34    22    "                           142   98    62    b

       043   35    23    #                           143   99    63    c

       044   36    24    $                           144   100   64    d

       045   37    25    %                           145   101   65    e

       046   38    26    &                           146   102   66    f

       047   39    27    ´                           147   103   67    g

       050   40    28    (                           150   104   68    h

       051   41    29    )                           151   105   69    i

       052   42    2A    *                           152   106   6A    j

       053   43    2B    +                           153   107   6B    k

       054   44    2C    ,                           154   108   6C    l

       055   45    2D    -                           155   109   6D    m

       056   46    2E    .                           156   110   6E    n

       057   47    2F    /                           157   111   6F    o

       060   48    30    0                           160   112   70    p

       061   49    31    1                           161   113   71    q

       062   50    32    2                           162   114   72    r

       063   51    33    3                           163   115   73    s

       064   52    34    4                           164   116   74    t

       065   53    35    5                           165   117   75    u

       066   54    36    6                           166   118   76    v

       067   55    37    7                           167   119   77    w

       070   56    38    8                           170   120   78    x

       071   57    39    9                           171   121   79    y

       072   58    3A    :                           172   122   7A    z

       073   59    3B    ;                           173   123   7B    {

       074   60    3C    <                           174   124   7C    |

       075   61    3D    =                           175   125   7D    }

       076   62    3E    >                           176   126   7E    ~

       077   63    3F    ?                           177   127   7F    DEL

 

   Tables

       For convenience, let us give more compact tables in hex and decimal.

 

          2 3 4 5 6 7       30 40 50 60 70 80 90 100 110 120

        -------------      ---------------------------------

       0:   0 @ P ` p     0:    (  2  <  F  P  Z  d   n   x

       1: ! 1 A Q a q     1:    )  3  =  G  Q  [  e   o   y

       2: " 2 B R b r     2:    *  4  >  H  R  \  f   p   z

       3: # 3 C S c s     3: !  +  5  ?  I  S  ]  g   q   {

       4: $ 4 D T d t     4: "  ,  6  @  J  T  ^  h   r   |

       5: % 5 E U e u     5: #  -  7  A  K  U  _  i   s   }

       6: & 6 F V f v     6: $  .  8  B  L  V  `  j   t   ~

       7: ´ 7 G W g w     7: %  /  9  C  M  W  a  k   u  DEL

       8: ( 8 H X h x     8: &  0  :  D  N  X  b  l   v

       9: ) 9 I Y i y     9: ´  1  ;  E  O  Y  c  m   w

       A: * : J Z j z

       B: + ; K [ k {

       C: , < L \ l |

       D: - = M ] m }

       E: . > N ^ n ~

       F: / ? O _ o DEL

 

NOTES

   History

       An ascii manual page appeared in Version 7 of AT&T UNIX.

 

       On  older  terminals, the underscore code is displayed as a left arrow, called backarrow, the caret is displayed

       as an up-arrow and the vertical bar has a hole in the middle.

 

       Uppercase and lowercase characters differ by just one bit and the ASCII character  2  differs  from  the  double

       quote  by just one bit, too.  That made it much easier to encode characters mechanically or with a non-microcon-

       troller-based electronic keyboard and that pairing was found on old teletypes.

 

       The ASCII standard was published by the United States of America Standards Institute (USASI) in 1968.

 

SEE ALSO

       iso_8859-1(7), iso_8859-10(7), iso_8859-13(7), iso_8859-14(7),  iso_8859-15(7),  iso_8859-16(7),  iso_8859-2(7),

       iso_8859-3(7), iso_8859-4(7), iso_8859-5(7), iso_8859-6(7), iso_8859-7(7), iso_8859-8(7), iso_8859-9(7)

 

COLOPHON

       This page is part of release 3.22 of the Linux man-pages project.  A description of the project, and information

       about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.

 

Linux                             2009-02-12                          ASCII(7)

 

 

 

 

==============================================[start 2018-01-26 19:35]===============================================

    static void test1() throws IOException {

        StringBuilder builder = new StringBuilder();

        builder

        .append("000:").append("\000").append("\n")

        .append("001:").append("\001").append("\n")

        .append("002:").append("\002").append("\n")

        .append("003:").append("\003").append("\n")

        .append("004:").append("\004").append("\n")

        .append("005:").append("\005").append("\n")

        .append("006:").append("\006").append("\n")

        .append("007:").append("\007").append("\n")

        .append("010:").append("\010").append("\n")

        .append("011:").append("\011").append("\n")

        .append("012:").append("\012").append("\n")

        .append("013:").append("\013").append("\n")

        .append("014:").append("\014").append("\n")

        .append("015:").append("\015").append("\n")

        .append("016:").append("\016").append("\n")

        .append("017:").append("\017").append("\n")

        .append("020:").append("\020").append("\n")

        .append("021:").append("\021").append("\n")

        .append("022:").append("\022").append("\n")

        .append("023:").append("\023").append("\n")

        .append("024:").append("\024").append("\n")

        .append("025:").append("\025").append("\n")

        .append("026:").append("\026").append("\n")

        .append("027:").append("\027").append("\n")

        .append("030:").append("\030").append("\n")

        .append("031:").append("\031").append("\n")

        .append("032:").append("\032").append("\n")

        .append("033:").append("\033").append("\n")

        .append("034:").append("\034").append("\n")

        .append("035:").append("\035").append("\n")

        .append("036:").append("\036").append("\n")

        .append("037:").append("\037").append("\n")

        .append("040:").append("\040").append("\n")

        .append("041:").append("\041").append("\n")

        .append("042:").append("\042").append("\n")

        .append("043:").append("\043").append("\n")

        .append("044:").append("\044").append("\n")

        .append("045:").append("\045").append("\n")

        .append("046:").append("\046").append("\n")

        .append("047:").append("\047").append("\n")

        .append("050:").append("\050").append("\n")

        .append("051:").append("\051").append("\n")

        .append("052:").append("\052").append("\n")

        .append("053:").append("\053").append("\n")

        .append("054:").append("\054").append("\n")

        .append("055:").append("\055").append("\n")

        .append("056:").append("\056").append("\n")

        .append("057:").append("\057").append("\n")

        .append("060:").append("\060").append("\n")

        .append("061:").append("\061").append("\n")

        .append("062:").append("\062").append("\n")

        .append("063:").append("\063").append("\n")

        .append("064:").append("\064").append("\n")

        .append("065:").append("\065").append("\n")

        .append("066:").append("\066").append("\n")

        .append("067:").append("\067").append("\n")

        .append("070:").append("\070").append("\n")

        .append("071:").append("\071").append("\n")

        .append("072:").append("\072").append("\n")

        .append("073:").append("\073").append("\n")

        .append("074:").append("\074").append("\n")

        .append("075:").append("\075").append("\n")

        .append("076:").append("\076").append("\n")

        .append("077:").append("\077").append("\n")

        .append("100:").append("\100").append("\n")

        .append("101:").append("\101").append("\n")

        .append("102:").append("\102").append("\n")

        .append("103:").append("\103").append("\n")

        .append("104:").append("\104").append("\n")

        .append("105:").append("\105").append("\n")

        .append("106:").append("\106").append("\n")

        .append("107:").append("\107").append("\n")

        .append("110:").append("\110").append("\n")

        .append("111:").append("\111").append("\n")

        .append("112:").append("\112").append("\n")

        .append("113:").append("\113").append("\n")

        .append("114:").append("\114").append("\n")

        .append("115:").append("\115").append("\n")

        .append("116:").append("\116").append("\n")

        .append("117:").append("\117").append("\n")

        .append("120:").append("\120").append("\n")

        .append("121:").append("\121").append("\n")

        .append("122:").append("\122").append("\n")

        .append("123:").append("\123").append("\n")

        .append("124:").append("\124").append("\n")

        .append("125:").append("\125").append("\n")

        .append("126:").append("\126").append("\n")

        .append("127:").append("\127").append("\n")

        .append("130:").append("\130").append("\n")

        .append("131:").append("\131").append("\n")

        .append("132:").append("\132").append("\n")

        .append("133:").append("\133").append("\n")

        .append("134:").append("\134").append("\n")

        .append("135:").append("\135").append("\n")

        .append("136:").append("\136").append("\n")

        .append("137:").append("\137").append("\n")

        .append("140:").append("\140").append("\n")

        .append("141:").append("\141").append("\n")

        .append("142:").append("\142").append("\n")

        .append("143:").append("\143").append("\n")

        .append("144:").append("\144").append("\n")

        .append("145:").append("\145").append("\n")

        .append("146:").append("\146").append("\n")

        .append("147:").append("\147").append("\n")

        .append("150:").append("\150").append("\n")

        .append("151:").append("\151").append("\n")

        .append("152:").append("\152").append("\n")

        .append("153:").append("\153").append("\n")

        .append("154:").append("\154").append("\n")

        .append("155:").append("\155").append("\n")

        .append("156:").append("\156").append("\n")

        .append("157:").append("\157").append("\n")

        .append("160:").append("\160").append("\n")

        .append("161:").append("\161").append("\n")

        .append("162:").append("\162").append("\n")

        .append("163:").append("\163").append("\n")

        .append("164:").append("\164").append("\n")

        .append("165:").append("\165").append("\n")

        .append("166:").append("\166").append("\n")

        .append("167:").append("\167").append("\n")

        .append("170:").append("\170").append("\n")

        .append("171:").append("\171").append("\n")

        .append("172:").append("\172").append("\n")

        .append("173:").append("\173").append("\n")

        .append("174:").append("\174").append("\n")

        .append("175:").append("\175").append("\n")

        .append("176:").append("\176").append("\n")

        .append("177:").append("\177").append("\n")

        ;

        String msg = builder.toString();

        System.out.println(msg);

 

        Files.write(msg.getBytes(), new File("/Users/kanpiaoxue/tmp/20180126193115.txt"));

    }

 

000:^@

001:^A

002:^B

003:^C

004:^D

005:^E

006:^F

007:^G

010

011:

012:

 

013:^K

014:^L

015:

016:^N

017:^O

020:^P

021:^Q

022:^R

023:^S

024:^T

025:^U

026:^V

027:^W

030:^X

031:^Y

032:^Z

033:ESC

034:^\

035:^]

036:^^

037:^_

040:

041:!

042:"

043:#

044:$

045:%

046:&

047:'

050:(

051:)

052:*

053:+

054:,

055:-

056:.

057:/

060:0

061:1

062:2

063:3

064:4

065:5

066:6

067:7

070:8

071:9

072::

073:;

074:<

075:=

076:>

077:?

100:@

101:A

102:B

103:C

104:D

105:E

106:F

107:G

110:H

111:I

112:J

113:K

114:L

115:M

116:N

117:O

120:P

121:Q

122:R

123:S

124:T

125:U

126:V

127:W

130:X

131:Y

132:Z

133:[

134:\

135:]

136:^

137:_

140:`

141:a

142:b

143:c

144:d

145:e

146:f

147:g

150:h

151:i

152:j

153:k

154:l

155:m

156:n

157:o

160:p

161:q

162:r

163:s

164:t

165:u

166:v

167:w

170:x

171:y

172:z

173:{

174:|

175:}

176:~

177:^?

==============================================[  end 2018-01-26 19:35]===============================================

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值