일반 범주
모든 코드 포인트를 7개 주요 분류(문자, 기호, 숫자, 구두점, 기호, 구분자, 기타)로 나뉜 30개 범주(Lu, Ll, Nd, So 등) 중 하나로 분류하는 체계.
What Is the General Category?
Every Unicode character is assigned a General Category (GC): a two-letter code that classifies it into a broad type such as uppercase letter, decimal digit, currency symbol, or control character. The category is one of the most fundamental Unicode properties and drives countless text-processing decisions—from determining whether a character is "alphabetic" to how it should be handled in identifier parsing.
There are seven top-level categories (Letter, Mark, Number, Punctuation, Symbol, Separator, Other) subdivided into 30 specific categories.
The 30 Category Codes
| Code | Name | Example |
|---|---|---|
| Lu | Uppercase Letter | A, Ñ |
| Ll | Lowercase Letter | a, ñ |
| Lt | Titlecase Letter | Dž |
| Lm | Modifier Letter | ʰ (modifier h) |
| Lo | Other Letter | 中, あ, ب |
| Mn | Non-spacing Mark | combining acute ◌́ |
| Mc | Spacing Mark | ◌ा (Devanagari vowel sign) |
| Me | Enclosing Mark | combining enclosing circle |
| Nd | Decimal Digit | 0–9, ٠–٩ (Arabic-Indic) |
| Nl | Letter Number | Ⅻ (Roman numeral 12) |
| No | Other Number | ½, ² |
| Pc | Connector Punctuation | _ (underscore) |
| Pd | Dash Punctuation | -, – |
| Ps | Open Punctuation | ( [ { |
| Pe | Close Punctuation | ) ] } |
| Pi | Initial Punctuation | " « |
| Pf | Final Punctuation | " » |
| Po | Other Punctuation | ! . , |
| Sm | Math Symbol | + = ∑ |
| Sc | Currency Symbol | $ € ¥ |
| Sk | Modifier Symbol | ^ ` ¨ |
| So | Other Symbol | © ♥ 🔶 |
| Zs | Space Separator | U+0020, U+00A0 |
| Zl | Line Separator | U+2028 |
| Zp | Paragraph Separator | U+2029 |
| Cc | Control | U+0000–U+001F |
| Cf | Format | U+200B ZERO WIDTH SPACE |
| Cs | Surrogate | U+D800–U+DFFF |
| Co | Private Use | U+E000–U+F8FF |
| Cn | Unassigned | any unassigned code point |
import unicodedata
samples = [("A", "Lu?"), ("a", "Ll?"), ("1", "Nd?"),
("中", "Lo?"), (" ", "Zs?"), ("©", "So?")]
for char, expected in samples:
gc = unicodedata.category(char)
print(f" {char!r:6} category={gc:4} ({expected})")
# 'A' category=Lu (Lu?)
# 'a' category=Ll (Ll?)
# '1' category=Nd (Nd?)
# '中' category=Lo (Lo?)
# ' ' category=Zs (Zs?)
# '©' category=So (So?)
Common Uses
Python's own str.isalpha(), str.isdigit(), and str.identifier rules are all defined in terms of General Category. Regex \w matches characters in L, N, Pc, and a few others. Security-sensitive applications use GC to detect confusable characters: two characters with GC=Ll (lowercase letter) that look similar but come from different scripts could be used in homograph attacks.
Quick Facts
| Property | Value |
|---|---|
| Unicode property name | General_Category |
| Short alias | gc |
| Number of two-letter codes | 30 |
| Top-level groups | L, M, N, P, S, Z, C (7) |
| Python function | unicodedata.category(char) → two-letter string |
| Spec reference | Unicode Standard Chapter 4 |
관련 용어
속성의 더 많은 용어
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개의 문자 체계를 …