The direct answer

Name the unit and exact input revision for every text limit. JavaScript string length, grapheme segments and UTF-8 output bytes answer different questions. Check each required ceiling against its own complete representation; a short display or passing string-length check cannot substitute for the payload-byte decision. None establishes model-token usage.

Start with the consumers and their separate ceilings

A fictional AI note editor has three requirements: a bounded JavaScript text field, a grapheme-based editing allowance and a UTF-8 note-payload ceiling. An operator sees a small character counter and treats it as evidence that every requirement passed. The missing information is what that counter measured.

This worksheet selects one already admitted, bounded valid Unicode scalar-text revision N-A and one fixed trusted adapter. It does not specify decoding, invalid-surrogate handling, normalization or repair. Those earlier decisions must be independently established. All receipts and eight cards are PROPOSED_UNRUN; no string, segmenter, encoder, buffer, browser or request fixture was constructed or exercised.

The Unicode identity guide already separates labels from authority. This worksheet adds consumer-specific size evidence without changing that identity policy or selecting an object from its display text.

Give each measurement an explicit meaning

MDN’s String length reference defines the value as UTF-16 code units, which can differ from the number of Unicode characters. Its grapheme example further distinguishes cluster counting. The existing widget contract deliberately uses a code-unit ceiling; this article does not reinterpret it as visible characters.

Intl.Segmenter provides locale-sensitive segmentation. Its segments follow the instance’s locale and granularity, and resolved options describe that profile. Our application chooses grapheme granularity explicitly. This is an editing unit, not a universal promise about rendered glyphs or every user’s perception.

TextEncoder.encode takes a string and returns its UTF-8 encoding in a Uint8Array. Therefore this selected payload’s byte evidence concerns that complete encoded result. It cannot be replaced with the code-unit counter or segment count.

Bind measurements to the same admitted revision

The original admission rule is simple: every required measure must identify N-A, its unit, the relevant profile and the declared ceiling. A green indicator without those fields is incomplete evidence. Three green indicators for three different text revisions are incomplete too.

Keep the content stable between measurement and use. If an adapter later adds a prefix, normalizes text, escapes it into another representation or appends a signature, that stage has a new input association to review. Do not reuse N-A’s receipt for changed bytes. This is a proposed application rule, not a demonstrated race-control or immutable-buffer implementation.

For the selected positive, trusted code controls the complete path into the note encoder. It preserves the admitted text and obtains a complete result associated with that revision. Actual runtime support, input validity, adapter behavior, lifecycle and current rights remain unimplemented or unknown. Missing evidence blocks real admission instead of inviting a guessed conversion ratio.

Use a small three-unit admission sheet

Original N-A teaching ledger — PROPOSED_UNRUN
Consumer requirementAssumed teaching receiptInvented ceiling
Text-field code-unit allowanceN-A / four UTF-16 code unitsEight code units
Editing allowanceN-A / four grapheme segments under admitted profile G-AEight segments
UTF-8 note payloadN-A / complete four-byte output E-AEight payload bytes

These invented receipt values describe an ordinary public ASCII note for discussion. They are not measurements, recommended production limits or a capacity result. The conditional positive requires independently established receipts and all actual prerequisites before the exact payload is eligible for its separate consumer review. We have established none of those runtime facts.

A real record should retain revision and disposition references rather than the note itself when contents are unnecessary. A mismatch should name the failed unit and ceiling. Do not silently trim, discard combining content, reinterpret a byte budget as characters or continue with a different note.

Separate payload size from work and total request size

Obtaining a complete encoded result is not proof that producing it stayed within memory, CPU or elapsed-work bounds. This profile starts with independently bounded input and requires separately supported resource controls. It provides no streaming limiter or allocation guarantee; checking the result afterward cannot retroactively constrain earlier work.

The note payload is also smaller in scope than its eventual message envelope. Serialization, surrounding instructions, attachments, transport framing and any compression need their own supported accounting. This guide supplies no HTTP Content-Length calculation, whole-request maximum, tokenizer, price estimate or spend reservation.

Keep data permission independent of every size check. A small confidential note can still be forbidden for the selected recipient. Likewise, a useful size receipt does not make instructions inside a note trustworthy or authorize an external action.

Walk eight inert unit-and-revision cards

All eight cards are PROPOSED_UNRUN
ConditionProposed disposition
1. Same N-A fits all three declared ceilings; every independent prerequisite holdsConditionally admit only the exact payload scope.
2. Code-unit allowance passes but encoded-byte ceiling failsWithhold payload; report the byte decision.
3. Grapheme allowance passes but the code-unit requirement failsPreserve both results; no visible-character override.
4. G-A or actual segmentation support is unknownHold the editing-unit claim; do not substitute another counter.
5. Text changes after the recorded measurementInvalidate that association for the changed representation.
6. Encoded result is partial, unavailable or lacks complete captureNo complete payload-byte admission.
7. Note fits but envelope or model-token evidence is missingMake no whole-request or usage claim.
8. Counts fit but data rights or intended use failDeny that use independently.

State the documentation and product limits

The inspected MDN bodies were modified on 2 September 2026, 20 July 2025 and 28 June 2025 respectively. No installed browser, segmentation-data revision or adapter was inspected. No normalization, encoding, counting, network request, tokenizer or model operation occurred for these cases.

Boundary is prelaunch with planned request-path checks, not a shipped text-budget verifier or editor. Its existing synthetic policy evidence covers different behavior. The worksheet claims no complete Unicode policy, rendering conformance, resource containment or production acceptance result.

Primary sources

Official references supporting the guidance. Examples in this guide are synthetic and are not reports of a production incident.

  1. MDN — String: length
  2. MDN — Intl.Segmenter
  3. MDN — TextEncoder.encode()