وحدة الرمز

Encoding & Standards

أصغر مجموعة بتات تُستخدم لترميز حرف: 8 بت لـ UTF-8، و16 بتًا لـ UTF-16، و32 بتًا لـ UTF-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.

المصطلحات ذات الصلة

UTF-16 UTF-16
ترميز Unicode متغير العرض يستخدم 2 أو 4 بايت لكل حرف، وتستخدمه JavaScript وJava وWindows داخليًا.
UTF-32 UTF-32
ترميز Unicode ثابت العرض يستخدم 4 بايت بالضبط لكل حرف، مما يوفر تعيينًا مباشرًا لنقاط الرمز على حساب المساحة.
UTF-8 UTF-8
ترميز Unicode متغير العرض يستخدم من 1 إلى 4 بايت لكل حرف، وهو الترميز السائد على الويب (تستخدمه 98%+ من المواقع).
الزوج البديل الزوج البديل
وحدتا ترميز UTF-16 (بديل عالٍ من U+D800 إلى U+DBFF يتبعه بديل منخفض من U+DC00 إلى U+DFFF) تمثلان معًا حرفًا يتجاوز U+FFFF.

الأدوات ذات الصلة

🔢 بحث Unicode بحث Unicode
أدخل نقطة كود مثل U+1F600 واحصل على الرمز التعبيري وتفاصيل الترميز وبايتات UTF-8/16 وكيانات HTML.