Skip to content

Release 9.2.0: keep combining marks and in-word joiners in modern Unicode slugs (#214) - #215

Merged
un33k merged 5 commits into
masterfrom
fix/modern-unicode-combining-marks
Nov 16, 2026
Merged

un33k merged 5 commits into
masterfrom
fix/modern-unicode-combining-marks

Conversation

@un33k

@un33k un33k commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Closes #214.

What

With algorithm='modern' and allow_unicode=True, combining marks (Unicode Mn/Mc: vowel signs, viramas, anusvara, Arabic harakat, Hebrew niqqud, etc.) are now kept as part of the word they follow, and ZWNJ/ZWJ (U+200C/U+200D) are kept when they sit between two word parts. Previously [\W_]+ treated those marks as separators and split words apart.

Input Before After
नमस्ते दुनिया नमस-त-द-न-य नमस्ते-दुनिया
ශ්‍රී ලංකාව ශ-ර-ල-ක-ව ශ්‍රී-ලංකාව
বাংলা ভাষা ব-ল-ভ-ষ বাংলা-ভাষা
שָׁלוֹם עוֹלָם ש-לו-ם שָׁלוֹם-עוֹלָם

The rule is category-based, so it applies to every affected script; tests cover Hindi, Tamil, Bengali, Gurmukhi, Telugu, Thai, Khmer, Myanmar, Sinhala (with ZWJ), Arabic, Hebrew and Persian (ZWNJ).

Compatibility

  • Legacy (the default) is unchanged. slugify/_legacy.py and tests/test_legacy.py are untouched.
  • Modern ASCII mode and custom regex_pattern are unchanged.
  • Modern Unicode output is identical for any text without combining marks or joiners: a test compares the new filter against [\W_]+ across every non-surrogate code point (>1M).
  • Orphan marks (no preceding letter), emoji variation selectors, and joiners at word edges remain separators; hard truncation never ends a slug with a joiner.
  • Output does change for modern Unicode slugs containing combining marks, hence the minor version bump.

Release 9.2.0

Bumps __version__, tools/check_dist.py and CHANGELOG.md (credit: Nipuna-Lakruwan, #214).

Verification

  • pytest: 140 passed on Python 3.11, 3.12, 3.13 and 3.14 (skips are for uninstalled transliteration backends)
  • flake8, pycodestyle, mypy, tools/check_algorithms.py clean
  • tools/check_dist.py: wheel and sdist 9.2.0 metadata, contents, install, CLI and Unicode-only runtime PASS
  • Not run locally: Python 3.10, PyPy, full tox backend matrix

🚀 Generated with Dojo ⛩️

@un33k
un33k merged commit cb0539e into master Nov 16, 2026
1 check passed
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.723% (+0.02%) from 99.701% — fix/modern-unicode-combining-marks into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow_unicode splits words at combining marks (Hindi, Tamil, Arabic, Hebrew)

2 participants