john-slop/docs/unicode-confusables.md

2.7 KiB

Ambiguous and invisible Unicode references

Gitea maintains the concrete list that most closely matches the requested "ambiguous Unicode characters" catalog:

At Gitea commit 9c715c0f9d12336e026e89be85f9f711c66e7ff6, the wrapped JSON contains 16 tables and 2,108 mapping pairs across them. _common contains 1,538 pairs; _default and the language-specific tables supply the remainder. The array values alternate between a confusable code point and the code point it resembles. Counts across tables are not necessarily unique global mappings.

Gitea's generator identifies hediet/vscode-unicode-data as its upstream. For standards-based identifier spoofing, the canonical broader reference is Unicode UTS #39 and its confusables.txt data file. GitHub separately documents a warning for hidden bidirectional text; that protection is about bidi controls rather than a published Gitea-style locale-aware lookalike table.

Implication for John Slop

These sources are useful detection references, not safe formatter replacement catalogs. Many listed characters are legitimate in particular languages and scripts, and Gitea deliberately interprets them through the reviewer's locale. Importing every pair as an automatic Unicode-to-ASCII edit would corrupt valid text and violate the formatter's conservative replacement contract.

A future implementation should therefore keep three policies separate:

  1. configured, explicitly safe formatter replacements;
  2. locale-aware confusable findings for human review; and
  3. invisible and bidirectional-control security findings.

Any vendored or generated catalog should pin its upstream Unicode/data version, retain provenance and licensing, test locale behavior and ordinary multilingual near-misses, and report exact source spans without silently rewriting text.