ViniIpsum / Resources

Words, visible characters and bytes are different counts

A character counter needs a definition. A visible letter can contain more than one Unicode code point, and its encoded bytes can differ from the number of marks you see. Choose a test that matches the limit enforced by your actual application.

What ViniIpsum counts

Character mode counts grapheme clusters using the browser’s Unicode segmentation support. A combined sequence may count as one visible cluster. Spaces and punctuation also count. This count is not a UTF-8 byte limit and is not necessarily the same as JavaScript string length. If the browser lacks segmentation support, the tool reports the limitation rather than silently promising identical counts.

Word boundaries depend on the script

For most collections, word mode uses whitespace-separated tokens. It includes punctuation attached to those tokens. For Chinese and Thai, it uses the browser’s automatic word segmentation and inserts spaces between selected tokens in word mode. That makes the selected units inspectable, but it is not a linguistic annotation service. Normal paragraph mode uses the sample prose instead.

Export format adds its own content

The statistics describe the generated text. HTML tags, JSON punctuation, list bullets, and Markdown list markers are additional export syntax. Do not use the displayed character count as the encoded size of a downloaded file. If your backend limits bytes, test the downloaded content using that backend’s real encoding and rules.

Use the right limit in a prototype

To test a narrow label, generate a small number of characters, then paste it into the actual component. To exercise a paragraph layout, choose a paragraph length rather than assuming that 100 words always occupy the same space. Typeface, script, size, and container width all affect the result.

Validate with your application

Check counting rules at both the input and server boundary when a real product enforces length limits. Different software versions can use different segmentation data. Browser segmentation is documented in MDN’s Intl.Segmenter reference.

Try Chinese and Thai word generation, or use English sample text to compare token-based and character-based output.