OOffsetIlex
Product

Product features · UTF-16 boundary offsets

01

Trace selection boundaries from source characters to UTF-16 units before passing offsets to an editor API.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

UTF-16 boundary offsets

● ● ●OffsetIlex●
A concrete starting point · UTF-16 boundary offsets ×
def utf16_offsets(text):
    if type(text) is not str or len(text) > 4096:
        raise ValueError("bounded text")
    offsets = [0]
    for char in text:
        value = ord(char)
        if 0xD800 <= value <= 0xDFFF:
            raise ValueError("unpaired surrogate")
        offsets.append(offsets[-1] + (2 if value > 0xFFFF else 1))
    return offsets
✳Map every code-point boundary in text of at most 4096 characters to its UTF-16 code-unit offset.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗