Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions slugify/slugify.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def slugify(
text = unicodedata.normalize('NFKC', text)
else:
text = unicodedata.normalize('NFKD', text)
text = unidecode.unidecode(text)

# make the text lowercase (optional)
if lowercase:
Expand Down
20 changes: 20 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,26 @@ def test_html_decimal_on(self):
r = slugify(txt, decimal=True)
self.assertEqual(r, 'z')

def test_html_decimal_on_transliterated(self):
# A decoded numeric entity must be transliterated to ASCII exactly like
# the same character passed in directly (docstring: Ž -> Ž -> z).
txt = 'ß' # ß
r = slugify(txt, decimal=True)
self.assertEqual(r, slugify('ß'))
self.assertEqual(r, 'ss')

def test_html_hexadecimal_on_transliterated(self):
txt = 'ß' # ß
r = slugify(txt, hexadecimal=True)
self.assertEqual(r, slugify('ß'))
self.assertEqual(r, 'ss')

def test_html_entities_on_transliterated(self):
txt = 'ß' # ß
r = slugify(txt, entities=True)
self.assertEqual(r, slugify('ß'))
self.assertEqual(r, 'ss')

def test_html_decimal_off(self):
txt = 'Ž'
r = slugify(txt, entities=False, decimal=False)
Expand Down