Skip to content

fix(strings): transliterate ß, æ, ø and Ł in slugify - #459

Merged
dgilland merged 2 commits into
dgilland:developfrom
jayhemnani9910:fix/slugify-deburr
Nov 15, 2026
Merged

dgilland merged 2 commits into
dgilland:developfrom
jayhemnani9910:fix/slugify-deburr

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Base: develop

slugify drops letters that have no Unicode decomposition:

slugify("Ærøskøbing")  # 'rskbing'
slugify("Straße 5")    # 'strae-5'
slugify("Łódź")        # 'odz'
slugify("Øl og brød")  # 'l-og-brd'

It uses NFKD and then encodes to ASCII with ignore. NFKD only splits letters like é into a base letter and a mark, so ß, æ, ø, Ł and œ are deleted. deburr already maps these (including the Latin Extended-A letters from #442), so slugify now runs the text through deburr first: aeroskobing, strasse-5, lodz, ol-og-brod. The existing cases (Un éléphant à l'orée du bois, the apostrophes) give the same slugs.

Added a test_slugify case that fails without the change. pytest tests: no new failures (the 334 pytest_mypy_testing cases fail the same way on develop here). Changelog and AUTHORS updated.

slugify relied on NFKD + ASCII encoding, which deletes letters that
have no decomposition, so "Ærøskøbing" became "rskbing" and
"Straße" "strae". Run the text through deburr first, which maps
these letters.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — jayhemnani9910:fix/slugify-deburr into dgilland:develop

@dgilland
dgilland merged commit 05548fb into dgilland:develop Nov 15, 2026
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.

3 participants