코드 유닛

Encoding & Standards

문자 인코딩의 최소 비트 조합: UTF-8은 8비트, UTF-16은 16비트, UTF-32는 32비트.

A code unit is the fundamental building block of a Unicode encoding form. It's important to distinguish code units from code points — a single code point may require multiple code units depending on the encoding.

In UTF-8, a code unit is 8 bits (1 byte). The emoji 😀 requires 4 code units. In UTF-16, a code unit is 16 bits (2 bytes). The same emoji requires 2 code units (a surrogate pair). In UTF-32, it's 1 code unit (4 bytes).

Many programming language string APIs operate on code units rather than code points, which is why string length calculations can be confusing with emoji.

관련 용어

서로게이트 쌍 서로게이트 쌍
U+FFFF 이상의 문자를 나타내기 위해 사용되는 두 개의 UTF-16 코드 유닛.
UTF-16 UTF-16
문자당 2 또는 4바이트를 사용하는 가변 너비 유니코드 인코딩으로, JavaScript와 Java에서 사용됩니다.
UTF-32 UTF-32
문자당 정확히 4바이트를 사용하는 고정 너비 유니코드 인코딩으로, 직접적인 코드 포인트 매핑을 제공합니다.
UTF-8 UTF-8
문자당 1~4바이트를 사용하는 가변 너비 유니코드 인코딩으로, 웹의 98% 이상에서 사용됩니다.

관련 도구

🔢 Unicode 조회 Unicode 조회
U+1F600과 같은 코드포인트를 입력하면 해당 이모지, 인코딩 세부 정보, UTF-8/16 바이트, HTML 엔티티를 확인할 수 있습니다.