Repository navigation
Conversation
One letter of a FORMAT_CHAR_SCRIPTS script exempted its whole token from `invisible` and `zalgo`. A bidi override inside a Hebrew word, tag characters inside an Arabic or Devanagari word, or a run of zero-width spaces inside a Persian word therefore passed and stayed in `normalized`. Judge each hidden character and mark by the nearest letters around it (script-neutral letters such as the tatweel are skipped). Kept: a single ZWNJ/ZWJ/ZWSP (or the ZWJ ZWNJ and ZWJ ZWNJ ZWJ idioms) in a word of these scripts with no other-script letter on either side, so joiners next to numerals and Thai/Khmer/Myanmar word breaks stay clean; a single implicit bidi mark or isolate next to an RTL letter or next to a number in an RTL word; CGJ between marks of such a letter; a format character of a neighbouring letter's script (never a blank glyph); and mark stacks on these letters. Everything else is judged as in a Latin word, and only the offending characters are stripped. Myanmar joins VARIATION_BASE_SCRIPTS to prevent a regression: its words were exempt as a whole, so its standardized dotted forms (letter + VS1, StandardizedVariants.txt) were never judged; per-letter judging would report them. Among FORMAT_CHAR_SCRIPTS only Mongolian (already listed) and Myanmar have standardized variants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
One letter of a
FORMAT_CHAR_SCRIPTSscript exempted its whole word frominvisibleand
zalgo. So anything hidden inside a Hebrew, Arabic, Persian or Indic word passedand stayed in
normalized:The same went for tag characters inside Arabic or Devanagari words.
Now each hidden character and mark is judged by the nearest letters around it
(script-neutral letters such as the tatweel are skipped). Still exempt:
scripts, with no letter of another script on either side (Persian ZWNJ, also next
to numerals; Indic conjuncts; Malayalam chillu; Thai/Khmer/Myanmar word breaks)
in an RTL word
Syriac abbreviation mark)
Everything else is judged as it would be in a Latin word, and only the offending
characters are stripped. Myanmar joins
VARIATION_BASE_SCRIPTSso its standardizeddotted forms (
က+ VS1) don't start being reported now that its words are no longerexempt as a whole. README wording for
FORMAT_CHAR_SCRIPTSis updated to match.Tests: 8 must-flag cases (overrides, tags, ZWSP runs, mixed-script joiners, Hangul
filler, bidi mark/isolate runs), zalgo on a Latin letter next to Hebrew points, and 23
must-not-flag cases across Persian, Hindi, Malayalam, Thai, Khmer, Myanmar, Hebrew
(incl. Biblical point order), Arabic, Syriac, Mongolian, Tibetan and Kurdish.
Heads-up: this touches the same lines in
analyzeTokenas #25.Whichever lands second needs a small rebase. I have it ready.
Checklist
pnpm lint && pnpm check-types && pnpm test && pnpm buildpass locallypnpm changeset) if this is a user-facing change (minor)Found while maintaining an extended version at https://github.com/cycanics/unicode-spoofing.
🤖 Generated with Claude Code