Text testing

A practical Unicode test set for character-limit fields

Test a text field with emoji, combining accents and boundary-length strings, then identify whether its limit counts visible characters, code points, UTF-16 units or bytes.

A field that accepts ten ordinary letters may reject ten emoji. Before shortening the text or reporting a bug, identify what the field measures. This small test set gives writers and developers a repeatable way to investigate the difference. Use invented sample text, not a customer's private information.

Start with four separate measurements

Open ClearCount and compare visible characters, Unicode code points, UTF-16 units and UTF-8 bytes. Visible characters are grapheme clusters: a base letter and its combining accent can form one cluster. The Unicode text-segmentation specification describes these boundaries. Encoding units answer a different question from what a reader perceives on screen.

Copy each sample without the surrounding label or an added newline. The accent in the third row is an ordinary e followed by U+0301, rather than the single precomposed character รฉ. Rendering can make the two versions look identical.

Small test strings, checked with browser-compatible JavaScript
SampleVisibleCode pointsUTF-16 unitsUTF-8 bytes
A1111
๐Ÿ˜€1124
eฬ (e + combining accent)1223
๐Ÿ‡บ๐Ÿ‡ธ1248
๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ171125

Test just below, at and above the boundary

For an advertised limit of ten, first try nine, ten and eleven copies of A. Record whether typing stops, a warning appears, or submission fails. Then repeat with emoji. Five copies of ๐Ÿ˜€ occupy ten UTF-16 units; ten copies occupy twenty units but still represent ten visible characters and ten code points. This makes a useful contrast with the ASCII baseline.

A native HTML maxlength constraint uses the platform's specified string-length behavior. Read the HTML constraint definition and the application's own documentation. A custom counter, server validator or database rule may measure something else. A match with one row is evidence to investigate, not proof of every validation rule.

Separate typing, pasting and saving

Run the same test by typing and pasting, then submit and reload the saved value. A browser can block further typing while a server independently rejects a value. A form may trim surrounding spaces or normalize Unicode before saving. Record the exact text that returns after reload; a displayed counter alone cannot prove that the stored text survived unchanged.

Test a multiline field with A, one hard line break, and B. ClearCount normalizes line endings for its statistics, so its UTF-8 number describes the normalized text, not necessarily the bytes of the original file or a serialized network request. JSON escaping, field names and transport encoding can add bytes. See the byte-limit guide when the destination sets a byte budget.

Download exact test strings and expected counts

Download the Unicode test fixtures (JSON). Each case contains an exact string, its code points, and expected counts before any trimming or normalization. Copy the decoded text value into the field; do not paste its surrounding JSON quotes or treat a literal \n escape as a line break.

Selected fixtures; counts apply to the decoded string
SampleGraphemesCode pointsUTF-16 unitsUTF-8 bytes
รฉ (U+00E9)1112
e + combining acute (U+0065 U+0301)1223
๐Ÿ˜€1124
๐Ÿ‡บ๐Ÿ‡ธ1248
A, LF line break, B3333

Here โ€œgraphemeโ€ means an extended grapheme cluster under Unicode text segmentation, rather than a count of printed ink marks. A line break still occupies a segment even though it has no letter shape. The Unicode segmentation standard describes the boundary rules. The fixtures use established characters; record the browser and Unicode implementation when investigating a disagreement.

Catch transformations with two checks

First compare the raw decoded input with the expected counts. Then save it in the destination and compare the value that comes back. The precomposed and combining-accent examples can look identical while occupying different numbers of bytes. A system that normalizes them may deliberately store the same representation; document that behavior instead of assuming a failed count.

The file also includes nine, ten and eleven ASCII letters and five versus six emoji, so you can test either side of a ten-unit boundary. The three-space case checks whether the destination trims input. These fixtures test string measurement, not every language, every emoji sequence or the size of an entire request. JSON punctuation, field names and escaping are outside the string's byte count.

Make the bug report reproducible

Save the browser and version, the field label, the stated limit, the test text, all four counts, the entry method and the final error. For invisible differences, record code points such as U+0065 U+0301. Do not silently replace accented names or remove emoji to conceal a mismatch between the product's stated rule and its behavior.

A useful report says: โ€œThis field says ten characters. Ten A letters save; five grinning-face emoji save; six do not. The rejected sample has six visible characters and twelve UTF-16 units.โ€ That gives the developer a concrete boundary to reproduce. It also lets the writer choose the correct counter setting while the destination's intended behavior is clarified.

Keep exploring