以下字节流被标识为 UTF-8,它包含希伯来语句子:דירות לשותפים בתל אביב - הומלס
. 我试图理解编码。
ubuntu@ip-10-126-21-104:~$ od -t x1 homeless-title-fromwireshark_followed_by_hexdump.txt
0000000 0a 09 d7 93 d7 99 d7 a8 d7 95 d7 aa 20 d7 9c d7
0000020 a9 d7 95 d7 aa d7 a4 d7 99 d7 9d 20 20 d7 91 d7
0000040 aa d7 9c 20 d7 90 d7 91 d7 99 d7 91 20 2d 20 d7
0000060 94 d7 95 d7 9e d7 9c d7 a1 0a
0000072
ubuntu@ip-10-126-21-104:~$ file -i homeless-title-fromwireshark_followed_by_hexdump.txt
homeless-title-fromwireshark_followed_by_hexdump.txt: text/plain; charset=utf-8
该文件是 UTF-8,我通过打开记事本(Windows 7)验证了这一点,输入希伯来字符ד
,然后保存文件。结果如下:
ubuntu@ip-10-126-21-104:~$ od -t x1 test_from_notepad_utf8_daled.txt
0000000 ef bb bf d7 93
0000005
ubuntu@ip-10-126-21-104:~$ file -i test_from_notepad_utf8_daled.txt
test_from_notepad_utf8_daled.txt: text/plain; charset=utf-8
ef bb bf
以 utf-8 形式编码的 BOM 在哪里,并且d7 93
正是出现在原始流中的字节序列之后0a 09
(新行,ascii 中的制表符)。
这里的问题是,通过 unicode 代码页,ד
应该这样编码,05 D3
为什么以及如何产生 utf-8 编码d7 93
?
d7 93
在二进制中是11010111 10010011
,而
05 D3
在二进制中是00000101 11010011
我似乎找不到对这些编码有意义的正确转换,(据我了解)代表相同的 Unicode 实体,即“希伯来字母 DALET”
谢谢你,
马克西姆。