0

是否存在任何字符编码,其中 0 字节不编码 null,而是编码更可连接的字符?我的 PHP 给了我这个编码列表:

    [0] => pass
    [1] => auto
    [2] => wchar
    [3] => byte2be
    [4] => byte2le
    [5] => byte4be
    [6] => byte4le
    [7] => BASE64
    [8] => UUENCODE
    [9] => HTML-ENTITIES
    [10] => Quoted-Printable
    [11] => 7bit
    [12] => 8bit
    [13] => UCS-4
    [14] => UCS-4BE
    [15] => UCS-4LE
    [16] => UCS-2
    [17] => UCS-2BE
    [18] => UCS-2LE
    [19] => UTF-32
    [20] => UTF-32BE
    [21] => UTF-32LE
    [22] => UTF-16
    [23] => UTF-16BE
    [24] => UTF-16LE
    [25] => UTF-8
    [26] => UTF-7
    [27] => UTF7-IMAP
    [28] => ASCII
    [29] => EUC-JP
    [30] => SJIS
    [31] => eucJP-win
    [32] => SJIS-win
    [33] => CP932
    [34] => CP51932
    [35] => JIS
    [36] => ISO-2022-JP
    [37] => ISO-2022-JP-MS
    [38] => Windows-1252
    [39] => Windows-1254
    [40] => ISO-8859-1
    [41] => ISO-8859-2
    [42] => ISO-8859-3
    [43] => ISO-8859-4
    [44] => ISO-8859-5
    [45] => ISO-8859-6
    [46] => ISO-8859-7
    [47] => ISO-8859-8
    [48] => ISO-8859-9
    [49] => ISO-8859-10
    [50] => ISO-8859-13
    [51] => ISO-8859-14
    [52] => ISO-8859-15
    [53] => ISO-8859-16
    [54] => EUC-CN
    [55] => CP936
    [56] => HZ
    [57] => EUC-TW
    [58] => BIG-5
    [59] => EUC-KR
    [60] => UHC
    [61] => ISO-2022-KR
    [62] => Windows-1251
    [63] => CP866
    [64] => KOI8-R
    [65] => KOI8-U
    [66] => ArmSCII-8
    [67] => CP850
    [68] => JIS-ms
    [69] => CP50220
    [70] => CP50220raw
    [71] => CP50221
    [72] => CP50222
4

2 回答 2

2

任何直接的多字节编码(例如所有形式的 UTF-16)都将每个代码点表示为两个字节,其中一个字节为零。因此,例如 U+0020 将表示为 0x00 0x20(大端)或 0x20 0x00(小端)。类似地,任何是 256 的偶数乘积的字符都将具有 0x00 的 LSB。

于 2013-01-29T20:56:59.273 回答
0

经典地,在 C 中,零字节用于标记字符串的结尾。在 PHP 中,字符串实际上可以包含零字节,但据我所知,没有将零字节编码为可打印字符的字符编码。

于 2013-01-29T20:50:55.923 回答