Skip to content

How should my app handle visually identical Unicode prompts when computing request fingerprints?

Define whether your application fingerprints exact submitted text or a documented normalized form, and apply that policy before approval. Visually identical Unicode strings can contain different code points. Do not normalize only during retry or silently rewrite text after the user approves the creative request.

TEST THE CUSTOMER API CONTRACTAISwapLab team · Editorial methodUpdated 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Choose a limited policy; Freeze after review; Test equivalent-looking inputs.
Workflow diagram: Choose a limited policy → Freeze after review → Test equivalent-looking inputs. Read the article for evidence and limits.

Visual equality is not byte equality

Accented characters can have composed or decomposed representations. Compatibility normalization can also change distinctions that matter in names, typography or source text. A fingerprint policy must prioritize fidelity and explain any transformations your editor performs.

What to do next

  1. 01

    Choose a limited policy

    For exact creative text, preserving submitted code points is often easiest to explain. If you normalize, choose a deliberate Unicode normalization form and define where it occurs; do not assume every form preserves every meaningful distinction.

  2. 02

    Freeze after review

    Show the effective text before approval and store it with the request snapshot. Compute the application fingerprint from that frozen representation, and reuse the same representation for dispatch and network recovery.

  3. 03

    Test equivalent-looking inputs

    Create composed and decomposed accents, mixed scripts and compatibility characters in offline fixtures. Confirm the system's identity behavior matches its stated policy and that reports do not hide which exact text was submitted.

A concrete example

Illustrative example: two drafts display the same accented word but use different code points. Under an exact-text policy they remain distinct drafts. Under a declared pre-approval NFC policy, the editor normalizes both before showing and freezing the approved text.

Before you call it ready

  • Normalization occurs before approval if used.
  • Retry uses the frozen representation.
  • Compatibility characters receive explicit test coverage.

A locally executed, reproducible check

Two visually similar prompt strings have different bytes until a stated normalization is applied.

We executed this exact synthetic fixture on November 16, 2026 with Python 3.12.10 and SQLite 3.49.1. It ran locally with no network requests, account data or model generation. The recorded output below is an observation from that environment, not a platform benchmark. Copy the code into a separate Python file to repeat it in a suitable local environment; compare the mechanism and check your runtime version.

python
import unicodedata,hashlib
a='café'
b='café'
digest=lambda x:hashlib.sha256(x.encode('utf-8')).hexdigest()
print('raw UTF-8 equal:',a.encode('utf-8')==b.encode('utf-8'))
print('raw hashes equal:',digest(a)==digest(b))
print('NFC hashes equal:',digest(unicodedata.normalize('NFC',a))==digest(unicodedata.normalize('NFC',b)))
print('submitted raw strings equal:',a==b)

Recorded output and interpretation

The test changes a local comparison representation only. Do not silently rewrite an approved submitted prompt or infer identical model behavior. NFC does not resolve confusable characters, case, whitespace or authorization.

A matching local output establishes only the illustrated library or database behavior under these inputs. It does not certify a production integration. Preserve the approved action, authorization boundaries and current AISwapLab request contract when applying the idea.

text
raw UTF-8 equal: False
raw hashes equal: False
NFC hashes equal: True
submitted raw strings equal: False

When to stop or choose another method

Stop changing Unicode normalization only in the retry path; that can alter the payload associated with an already approved request identity.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation