我怎么能弄清楚这个文件的字符编码?

时间:2015-08-05 17:58:20

标签: character-encoding

我有一个数据文件,当我用vim,nano或cat查看它时,将无法正确显示,并且根据查看器,将采用不同的编码。这是OSX上的TextEdit应用程序查看的示例行:

* thread #1: tid = 0x1386d, 0x0000000100000e08 a.out`main + 72 at t.cpp:19, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000e08 a.out`main + 72 at t.cpp:19
   16   {
   17       Test *obj;
   18       obj = new Test(1, 2);
-> 19       obj->destroy();
   20       Test *sss = new Test(7, 8);
   21       obj->print();
   22       return 0;
(lldb) p obj
(Test *) $5 = 0x0000000100104aa0
(lldb) x $5
0x100104aa0: 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ................
0x100104ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
(lldb) n
Process 5010 stopped
* thread #1: tid = 0x1386d, 0x0000000100000e17 a.out`main + 87 at t.cpp:20, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000e17 a.out`main + 87 at t.cpp:20
   17       Test *obj;
   18       obj = new Test(1, 2);
   19       obj->destroy();
-> 20       Test *sss = new Test(7, 8);
   21       obj->print();
   22       return 0;
   23   }
(lldb) p obj
(Test *) $6 = 0x0000000100104aa0
(lldb) x $6
0x100104aa0: 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ................
0x100104ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
(lldb) n
Process 5010 stopped
* thread #1: tid = 0x1386d, 0x0000000100000e4b a.out`main + 139 at t.cpp:21, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000e4b a.out`main + 139 at t.cpp:21
   18       obj = new Test(1, 2);
   19       obj->destroy();
   20       Test *sss = new Test(7, 8);
-> 21       obj->print();
   22       return 0;
   23   }
(lldb) x $6
0x100104aa0: 07 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00  ................
0x100104ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
(lldb) p sss
(Test *) $7 = 0x0000000100104aa0
(lldb) p obj
(Test *) $8 = 0x0000000100104aa0
(lldb)

这是nano:

….80RMî‘“q∂€r€mqpÄçÊ€~7€m∆

(我不知道它们是否是同一条线,因为它们都有不同的长度)

我怎么能解码它以便它可读?

0 个答案:

没有答案