UTF-32

Encoding & Standards

การเข้ารหัส Unicode แบบความกว้างคงที่ ใช้ 4 ไบต์ต่ออักขระพอดี ทำให้แมปโค้ดพอยท์ได้โดยตรงแต่ใช้พื้นที่มากกว่า

UTF-32 is the simplest Unicode encoding: every character uses exactly 4 bytes, and the value directly corresponds to the code point. This makes random access and character counting trivial.

However, UTF-32 uses 4x the memory of ASCII text and 2x that of UTF-16 for most common characters. It's rarely used for storage or transmission but can be convenient for internal string processing.

Python 3's internal string representation uses a variable-width encoding (Latin-1, UCS-2, or UCS-4) depending on the highest code point in the string, which is why `len('😀')` correctly returns 1.

คำที่เกี่ยวข้อง

BOM (BOM) BOM (BOM)
Byte Order Mark (U+FEFF) ที่วางไว้ที่ต้นไฟล์ข้อความเพื่อระบุลำดับไบต์ (endianness) ในการเข้ารหัส UTF-16/UTF-32
UTF-16 UTF-16
การเข้ารหัส Unicode แบบความกว้างผันแปร ใช้ 2 หรือ 4 ไบต์ต่ออักขระ ใช้ภายในโดย JavaScript, Java และ Windows
UTF-8 UTF-8
การเข้ารหัส Unicode แบบความกว้างผันแปร ใช้ 1 ถึง 4 ไบต์ต่ออักขระ เป็นมาตรฐานหลักบนเว็บ (ใช้โดยเว็บไซต์กว่า 98%)
โค้ดยูนิต โค้ดยูนิต
การรวมบิตขั้นต่ำที่ใช้เข้ารหัสอักขระ: 8 บิตสำหรับ UTF-8, 16 บิตสำหรับ UTF-16 และ 32 บิตสำหรับ UTF-32

เครื่องมือที่เกี่ยวข้อง

🔢 ค้นหา Unicode ค้นหา Unicode
ป้อนจุดรหัสเช่น U+1F600 และรับ emoji, รายละเอียดการเข้ารหัส, ไบต์ UTF-8/16 และ HTML entities