양방향 범주
양방향 텍스트(왼쪽에서 오른쪽, 오른쪽에서 왼쪽, 약, 중립)에서 문자의 동작 방식을 결정하는 속성. 표시 순서를 결정하기 위해 유니코드 양방향 알고리즘이 사용합니다.
What Is the Bidirectional Category?
The Bidi Class (formally Bidi_Class, also called bidirectional category) is a Unicode property that controls how characters are positioned in a line of mixed left-to-right (LTR) and right-to-left (RTL) text. It is the primary input to the Unicode Bidirectional Algorithm (UBA, described in Unicode Standard Annex #9), which determines the visual display order of characters in a paragraph.
Every code point is assigned one of 23 Bidi Class values. The algorithm uses these values—along with explicit directional override characters—to resolve the correct rendering order for Arabic mixed with English, Hebrew mixed with numbers, or any other bidirectional combination.
The Major Bidi Class Values
| Code | Name | Typical Characters |
|---|---|---|
| L | Left-to-Right | Latin letters, digits in LTR context |
| R | Right-to-Left | Hebrew letters |
| AL | Arabic Letter | Arabic and Thaana letters |
| EN | European Number | 0–9 |
| AN | Arabic Number | Arabic-Indic digits ٠–٩ |
| ES | European Separator | + − |
| ET | European Terminator | $ % ° |
| ON | Other Neutral | most punctuation |
| BN | Boundary Neutral | Format chars, ZWJ |
| NSM | Non-Spacing Mark | combining marks (inherit from base) |
| WS | Whitespace | space, tab |
| B | Paragraph Separator | U+2029 |
| S | Segment Separator | tab in certain contexts |
| LRE/RLE/LRO/RLO | Explicit Embedding | directional embedding characters |
| LRM/RLM | Mark | U+200E LEFT-TO-RIGHT MARK, U+200F |
| LRI/RLI/FSI/PDI | Isolate | Unicode 6.3+ directional isolates |
import unicodedata
chars = [("A", "Latin"), ("ب", "Arabic"), ("5", "Digit"),
("\u200F", "RLM"), ("\u200E", "LRM")]
for char, label in chars:
bc = unicodedata.bidirectional(char)
print(f" {label:12} U+{ord(char):04X} Bidi={bc}")
# Latin U+0041 Bidi=L
# Arabic U+0628 Bidi=AL
# Digit U+0035 Bidi=EN
# RLM U+200F Bidi=R
# LRM U+200E Bidi=L
Why It Matters in Practice
Without correct bidi handling, a string like "Hello مرحبا World" will display with the Arabic word in the wrong position or with punctuation displaced. HTML provides dir attributes and the Unicode characters U+200F (RLM), U+200E (LRM), and the bidi isolate characters (U+2066–U+2069) to guide the algorithm. Web developers working with RTL content must understand that the visual order of characters on screen differs from their logical (storage) order.
Quick Facts
| Property | Value |
|---|---|
| Unicode property name | Bidi_Class |
| Short alias | bc |
| Number of values | 23 |
| Python function | unicodedata.bidirectional(char) → string code |
| Algorithm spec | Unicode Standard Annex #9 (UAX #9) |
| Key characters | U+200E LRM, U+200F RLM, U+2066–U+2069 isolates |
관련 용어
속성의 더 많은 용어
Unicode property (UAX#11) classifying characters as Narrow, Wide, Fullwidth, Halfwidth, Ambiguous, or …
Unicode property controlling how Arabic and Syriac characters connect to adjacent characters. …
Unicode property listing all scripts that use a character, broader than the …
정규 분해 과정에서 결합 기호의 순서를 제어하는 수치 값(0~254)으로, 어떤 결합 기호를 …
마침표, 쉼표, 대시, 따옴표 등 문어를 구성하고 명료하게 하는 데 사용되는 문자. …
지원하지 않는 프로세스에서 눈에 보이는 효과 없이 무시할 수 있는 문자로, 이형 …
문자가 처음 할당된 유니코드 버전. 시스템 및 소프트웨어 버전 간의 문자 지원 …
문자를 대문자, 소문자, 제목 대문자로 변환하는 규칙. 로케일에 따라 달라질 수 있으며(터키어 …
RTL 문맥에서 글리프를 수평으로 반전해야 하는 문자. 예: ( → ), [ …
문자가 속한 문자 체계(예: 라틴, 키릴, 한자). Unicode 16.0은 168개의 문자 체계를 …