在QSHELL中,我用不同的编码方式对两个文本相同的文件做猫,并且都打印相同的内容,查找(hell.txt是EBCDIC,hellascii.txt是ASCII):
猫hellascii.txt
你好,“猫”hell.txt
你好,“-x hell.txt”
0000000 4040 4040 8885 9393 9640 7c7c 7c7c 7c7c
0000020 7c25
0000022 od -x hellascii.txt
0000000 2020 6865 6c6c 6f20 4040 4040 4040
0000020 4000
0000021
在我的笔记本电脑中,在linux或mac中,EBCDIC编码显示了其他看起来混乱的字符。as400中的unix如何正确地打印?我没有看到任何指示编码的文件头。例如,0x40在EBCDIC中是@ in ascii和space,但是cat在hell.txt中正确地打印0x40作为空格,在hellascii.txt中打印为@。
发布于 2021-03-13 16:59:40
在IBM上,系统跟踪分配给每个IFS文件的CCSID。您可以通过使用od的-C选项来查看CCSID。下面是一个例子。
$ od -tx -C helloascii.txt
helloascii.txt CCSID = 819
0000000 68692074 68657265 0a000000
0000011
$ od -tx -C helloebcdic.txt
helloebcdic.txt CCSID = 256
0000000 888940a3 88859985 25000000
0000011您可以使用-C选项touch分配新文件的CCSID。下面是我如何创建上面使用的文件。
$ touch -C 819 helloascii.txt
$ echo 'hi there' >> helloascii.txt
$ touch -C 256 helloebcdic.txt
$ echo 'hi there' >> helloebcdic.txthttps://stackoverflow.com/questions/66614372
复制相似问题