NEW
A numerical value in a character set that uniquely identifies a character or control element.
DESCRIPTION
A code point is an integer in a coded character set, such as Unicode, that identifies a character, control, or reserved value. In Unicode, code points range from U+0000 to U+10FFFF. Code points differ from code units, which are storage units in specific encodings like UTF-8 or UTF-16. A single user-perceived character (grapheme) can be composed of multiple code points. Understanding code points is essential for correct string handling, normalization, and internationalization. They underpin text processing across programming languages, databases, and network protocols.
ALTERNATIVE DEFINITIONS
Unicode Consortium
Any value in the Unicode codespace; that is, the range of integers from 0 to 10FFFF.
Precise scope within Unicode codespace and numeric range.
W3C
Code point: A value in the Unicode codespace.
Web standards context and alignment with Unicode definition.
RELATED TERMS
Unicode UTF-8 Grapheme Cluster Unicode Scalar Value ASCII Combining Character Surrogate Pair Feature Scaling Character Encoding
COMPETING TERMS
KNOWLEDGE AREAS
Programming Languages Software Engineering Data Integration & Interoperability
TARGET AUDIENCE
Software Developer Data Engineer Full Stack Developer Software Architect
EXTERNAL SOURCES
- Wikipedia - Code point
- Unicode Consortium - Unicode Standard specification
- W3C - Character model for the Web
TOP QUESTIONS
What is a Code Point in Unicode?
In Unicode, a code point is an integer from U+0000 to U+10FFFF that identifies a character, control, or reserved value. It’s the abstract identity, not the storage form.
Category: Overview
How do Code Points differ from Code Units?
Code points identify characters, while code units are the encoding-specific storage units (e.g., bytes in UTF-8, 16-bit words in UTF-16). One code point can map to multiple code units.
Category: Misunderstanding
Why should developers care about Code Points?
Correct handling of code points prevents text corruption, broken emoji, and security bugs. It’s critical for normalization, slicing, and regex in internationalized applications.
Category: Relevancy
How are Code Points represented in source code?
They’re commonly written as U+XXXX hexadecimal values. Many languages provide escape sequences (e.g., \uXXXX or \UXXXXXXXX) for literals and APIs to convert between encodings.
Category: HowTo
What is a Grapheme Cluster versus a Code Point?
A grapheme cluster is a user-perceived character, which may consist of multiple code points (e.g., base letter plus combining marks or multi-code-point emojis).
Category: Misunderstanding
What are common mistakes with Code Points?
Assuming one character equals one code unit or one byte is a classic mistake. Another is truncating strings without regard to grapheme clusters or surrogate pairs.
Category: Mistakes
How do Code Points affect sorting and comparison?
Sorting and comparison often require collation rules beyond numeric code point order. Locale-aware collation ensures culturally correct ordering of characters.
Category: Requirements
Are Code Points unique across encodings?
The code point identity is independent of encoding, but the encoding determines how it’s stored as code units or bytes. Unicode standardizes these identities globally.
Category: Opinion
Where can I learn more about Code Points?
Read the Unicode Standard and W3C Character Model. Language-specific documentation also explains APIs for code point iteration and encoding conversions.
Category: Learning