UTF-32

Encoding & Standards

1文字あたり正確に4バイトを使用する固定長Unicode符号化方式。コードポイントへの直接マッピングが可能だが、ストレージ効率が低い。

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)
UTF-16/UTF-32エンコーディングでバイト順序(エンディアン)を示すためにテキストファイルの先頭に置かれる文字(U+FEFF)。
UTF-16 UTF-16
1文字あたり2または4バイトを使用する可変長Unicode符号化方式。JavaScript、Java、Windowsが内部的に使用している。
UTF-8 UTF-8
1文字あたり1〜4バイトを使用する可変長Unicode符号化方式。ウェブで最も普及しており、98%以上のウェブサイトで使用されている。
コード単位 コード単位
文字を符号化するための最小ビット単位。UTF-8では8ビット、UTF-16では16ビット、UTF-32では32ビット。

関連ツール

🔢 Unicode 検索 Unicode 検索
U+1F600 のようなコードポイントを入力すると、対応する絵文字、エンコード詳細、UTF-8/16 バイト、HTML エンティティを確認できます。