Finding where a line may wrap is not the same as counting words or splitting strings on spaces. UAX #14 defines a default line-breaking framework based on character properties and pair rules, while browsers apply CSS language- and layout-specific tailoring. Implementations must preserve grapheme integrity and avoid breaking inside emoji sequences or combining marks simply because a fixed column width has been reached.
Line break opportunities are properties of boundaries
The Unicode Line Breaking Algorithm assigns line break classes and rules to identify allowed or prohibited break positions. It does not itself choose the most aesthetically pleasing set of lines for a page; a layout engine chooses breaks given widths, fonts and higher-level constraints.
A character can be classified for line breaking differently than for word segmentation. Unicode UAX #29 grapheme and word boundaries address separate operations. Do not replace UAX #14 with a generic split on U+0020 if the application supports CJK or languages without interword spaces.
Latin whitespace and punctuation are only one case
In simple English prose, spaces often provide break opportunities; however, nonbreaking spaces, punctuation, quotation marks and hyphens alter available positions. U+00A0 NO-BREAK SPACE has a specific nonbreaking role distinct from ordinary U+0020.
The presence of visible whitespace is neither necessary nor sufficient for an allowed break in every script. Copying text with its no-break controls stripped can change the flow even if the words remain legible.
CJK line breaking requires character class awareness
Chinese and Japanese text often contains long runs without spaces. UAX #14 and language-specific typography constrain line starts/ends around opening and closing punctuation and other characters. CSS line-break can influence CJK strictness in supported browsers.
Breaking before a closing bracket or after an opening bracket may be unacceptable even where a naive character-per-cell algorithm finds space. Tests should include fullwidth punctuation, ideographs, kana and mixed Latin text in the same line.
Thai and similar scripts may need linguistic segmentation
Several writing systems do not reliably mark words with ASCII spaces. Dictionary or other language-sensitive segmentation may contribute to user-friendly line break opportunities beyond simple Unicode pair rules.
A fallback breaker might still produce emergency breaks to avoid overflow, but these do not prove linguistically correct boundaries. Different ICU or platform dictionary versions can produce different break results for the same scalar sequence.
Combining sequences must remain intact
A base letter and its combining mark normally belong to the same extended grapheme cluster. Permitting a line break between U+0065 and U+0301 leaves an accent stranded at the start of a line. UAX #14 includes rules respecting relevant combining-mark behavior.
Do not insert U+000A into the middle of UTF-16 surrogate pairs or grapheme sequences when creating a hard-wrapped export. A byte counter cannot determine safe character boundaries; compute boundaries using Unicode-aware algorithms.
Emoji ZWJ and regional indicators challenge simplistic breakers
The emoji π©βπ» is a joined sequence containing U+200D. Flag sequences built from regional indicators also need coordinated grapheme and line break handling. A renderer should not assume each code point can break independently.
UAX #14 is designed to prevent inappropriate breaks for many such sequences, but actual emoji repertoire and rendering support can still vary by Unicode version and platform. Separate the validity of a break position from whether one glyph image is available.
CSS controls language- and product-specific policy
The CSS Text specifications define overflow-wrap, word-break, line-break, hyphens and related properties. These express different decisions. overflow-wrap:anywhere supplies otherwise unavailable emergency opportunities; it does not mean normal break opportunities were absent from Unicode.
word-break:break-all and word-break:keep-all change wrapping behavior in ways that require tests in Latin and CJK content. A UI can deliberately permit emergency breaks, but should not confuse them with dictionary word boundaries.
Soft hyphens and hard line endings have different semantics
U+00AD SOFT HYPHEN is a conditional formatting opportunity; when a break occurs, a hyphen may become visible depending on rules. U+000A LF is an actual line separator in many text formats, while an HTML line box break need not add a newline to source data.
When exporting wrapped text, decide whether to preserve original logical lines or serialize visual wrapping into hard line endings. Visual layout can change with font and viewport; storing hard breaks at todayβs pixel positions can damage text when reflowed.
Verify actual break opportunities and final wrapping separately
Use a fixed Unicode corpus, Unicode version, language metadata, font and CSS to test opportunities. Include English with NBSP, CJK punctuation, Thai, base+mark, emoji ZWJ, regional-indicator flags and narrow viewports.
A renderer's chosen wrap points also depend on measured advances and layout constraints. Report both the break-eligibility decision and final line arrangement. Where tailoring exists, document it as an application or CSS choice rather than an intrinsic change to Unicode data.
Reproducible specimen and observable boundaries
The following controlled example tests one narrowly defined distinction. It cannot alone establish correctness of a complete multilingual application. Preserve the original Unicode scalar values, identify any normalization or transliteration performed, and separately inspect font rendering, selection, data serialization and user-interface behavior.
const samples = ['e\u0301', 'π©\u200Dπ»', 'πΊπΈ', 'A\u00A0B'];
const seg = new Intl.Segmenter('en',{granularity:'grapheme'});
for(const s of samples) console.log([...seg.segment(s)].map(x=>x.segment));
// Grapheme segmentation is NOT a complete implementation of UAX #14.
// CSS examples: overflow-wrap:anywhere; word-break:normal; line-break:strict;For interop reports, record the input stream, chosen language or locale (if meaningful), browser or runtime version, relevant font files and output. When the outcome is only visually different, avoid changing source characters until the rendering or layout stage responsible for the mismatch has been isolated.
Technical comparison: data, algorithms and presentation
| Component or case | Concrete input | Correct interpretation |
|---|---|---|
| Ordinary space | U+0020 | often permits a break, context-dependent |
| No-break space | U+00A0 | avoids a normal break at this position |
| Combining mark | U+0065 U+0301 | no split inside grapheme |
| Emoji ZWJ | π©βπ» | sequence should remain intact |
| CJK punctuation | opening/closing brackets | script-specific start/end restrictions |
| CSS emergency wrap | overflow-wrap:anywhere | higher-level layout fallback |
Examples in this table represent distinct test contracts. Exact Unicode scalar equivalence is stronger than visual similarity, and an application may legitimately tailor text processing to language or product needs. Do not generalize one font's glyph appearance as a universal Unicode requirement.
Conformance and regression testing
- Ordinary space. Preserve a fixture containing
U+0020. Specify the Unicode version, application environment and expected observations. Verify that often permits a break, context-dependent; compare the actual code-point stream separately from appearance. - No-break space. Preserve a fixture containing
U+00A0. Specify the Unicode version, application environment and expected observations. Verify that avoids a normal break at this position; compare the actual code-point stream separately from appearance. - Combining mark. Preserve a fixture containing
U+0065 U+0301. Specify the Unicode version, application environment and expected observations. Verify that no split inside grapheme; compare the actual code-point stream separately from appearance. - Emoji ZWJ. Preserve a fixture containing
π©βπ». Specify the Unicode version, application environment and expected observations. Verify that sequence should remain intact; compare the actual code-point stream separately from appearance. - CJK punctuation. Preserve a fixture containing
opening/closing brackets. Specify the Unicode version, application environment and expected observations. Verify that script-specific start/end restrictions; compare the actual code-point stream separately from appearance. - CSS emergency wrap. Preserve a fixture containing
overflow-wrap:anywhere. Specify the Unicode version, application environment and expected observations. Verify that higher-level layout fallback; compare the actual code-point stream separately from appearance.
For broader coverage, exercise known difficult cases rather than only ASCII text: decomposed accents, supplementary characters, mixed direction, language-specific scripts and emoji sequences where relevant. Include expected negative results and document any product-specific tailoring. Keep fixtures stable and versioned so future Unicode or browser updates remain diagnosable.
Interpreting false positives
A difference is not automatically a failure. Some font and platform variation is permitted; conversely, two identical screenshots may hide distinct scalar streams. A reliable defect report cites the applicable rule, names the observed implementation layer, and demonstrates how its contract is violated without silently discarding the original text.
Primary standards and authoritative implementation documentation
These references define the relevant Unicode properties, web layout semantics or platform APIs. Unicode data files and browser conformance can evolve independently; record the tested version rather than presuming that every installed system has identical support.
- Unicode Line Breaking Algorithm UAX #14 β consult the primary specification or implementation reference for precise conformance wording, versions, property definitions and edge conditions.
- Unicode Text Segmentation UAX #29 β consult the primary specification or implementation reference for precise conformance wording, versions, property definitions and edge conditions.
- CSS Text Module Level 3 β consult the primary specification or implementation reference for precise conformance wording, versions, property definitions and edge conditions.
- CSS Text Module Level 4 β consult the primary specification or implementation reference for precise conformance wording, versions, property definitions and edge conditions.
- ICU Boundary Analysis β consult the primary specification or implementation reference for precise conformance wording, versions, property definitions and edge conditions.
Related technical references
Within the Multilingual Text & Input Systems virtual silo, these already published studies provide additional context for source text, rendering, editing and interchange: