[Encoding] 字元編碼指南 (ASCII / Unicode UTF-8)

ASCII | UTF-8 | UTF-16 | UTF-32 | Big5 |

Intro


ASCII (ISO/IEC 646)

Item Content
MIME / IANA us-ascii
字節長度 (Byte length) 1 byte
定義字元 (Characters) 128個 (7bits)
控制字元 (Control code) 0-37, 127

Unicode (ISO 10646)

UTF-8

Item Content
擴展來源 (Extends) ACSII
字節長度 (Byte length) 1~4 bytes (RFC 3629)
BOM (非必要) EF BB BF
Byte length Characters Byte 1 Byte 2 Byte 3 Byte 4 Content
1 byte 128個 0xxxxxxx ASCII
2 bytes 1920個 110xxxxx 10xxxxxx 附加符號的字母
3 bytes 61440個 1110xxxx 10xxxxxx 10xxxxxx BMP字元(如中文)
4 bytes 1048576個 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 極少使用的輔助平面的字元(如emoji)

UTF-16

Item Content
ACSII編碼 不相容
字節長度 (Byte length) 2 or 4 bytes
BOM (BE大端序) FE FF
BOM (LE小端序) FF FE
Byte length Characters Byte 1 Byte 2 Byte 3 Byte 4 Content
2 bytes 65536
(63488個)
xxxxxxxx xxxxxxxx BMP字元(如中文)
4 bytes 1048576
(524288個)
110110xx
110111xx
xxxxxxxx 110111xx
110110xx
xxxxxxxx 極少使用的輔助平面的字元(如emoji)

UTF-32 (不常用)

Item Content
ACSII編碼 不相容
字節長度 (Byte length) 4 bytes
BOM (BE大端序) 00 00 FE FF
BOM (LE小端序) FF FE 00 00

Big5

Item Content
擴展來源 (Extends) ACSII
擴展應用 (Extensions) Big5-HKSCS
字節長度 (Byte length) 1~2 bytes
定義字元 (Characters) 13060 個漢字

Leave a Reply

Your email address will not be published. Required fields are marked *