Convert text offsets between UTF-16, code points, UTF-8 bytes and graphemes, and locate hidden Unicode
Reports the length of a string in UTF-16 code units, Unicode code points, UTF-8 bytes and extended grapheme clusters (Intl.Segmenter), converts up to 200 ranges given in any one of those units into all four, and flags ranges that fall inside a surrogate pair, a multi-byte UTF-8 character or a grapheme cluster. It also runs the unicode-check rules (bidi controls, zero-width and invisible characters, tag characters, confusables) and returns each finding's offsets in all four systems, plus line-ending, BOM, normalization-form (NFC/NFD) and unpaired-surrogate facts. Grapheme boundaries follow the ICU version of this runtime. Does not decode bytes or fix text.
What you get
Offsets that agree between a JS model, a Rust tool and a byte-based API. 50,000 characters per $0.005 call.
Call it
Send the JSON body below to https://agents.writerslogic.com/api/v1/text-offsets. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.
curl -i -X POST https://agents.writerslogic.com/api/v1/text-offsets \
-H 'content-type: application/json' \
-d '{"text":"naïve 👨👩👧 evil","ranges":[{"unit":"grapheme","start":6,"end":7},{"unit":"utf8","start":6,"end":8}]}'
Input
| Field | Type | Required | Description |
|---|---|---|---|
text | string; length 0..50000 | yes | The string. |
ranges | array<object>; max 200 items | no | Half-open ranges to convert; each is read in its own unit. |
kind | string; one of "text", "identifier", "url" | no | How the unicode rules treat the string. Default text. |
scan | boolean | no | Run the hidden-Unicode rules. Default true. |
Example request body
{
"text": "naïve 👨👩👧 evil",
"ranges": [
{
"unit": "grapheme",
"start": 6,
"end": 7
},
{
"unit": "utf8",
"start": 6,
"end": 8
}
]
}
Result
The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.
| Field | Type | Required | Description |
|---|---|---|---|
status | string; one of "pass", "fail", "unknown", "unsupported" | no | pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass. |
lengths | object | no | |
properties | object | no | |
ranges | array<object>; max 200 items | no | |
unicode | object | no | |
witnesses | array<object> | no | |
versions | object | no | Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile). |
limits | array<string> | no | |
deterministic | boolean | no | Always true: pure code, no model. |
Pay and connect
Available through: x402 (USDC on Base), MCP. MCP clients reach it through the context-evidence-kit package.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent