unicode-slugify: A Robust Python Slugifier for Unicode Strings

This repository profile is provided by osrepos.com, an open source repository discovery platform.

unicode-slugify: A Robust Python Slugifier for Unicode Strings

Summary

unicode-slugify is a Python library developed by Mozilla, designed to generate URL-friendly slugs from strings containing Unicode characters. It offers powerful customization options, allowing users to control case, spaces, and allowed characters, making it suitable for diverse web development needs. This tool ensures that your slugs remain readable and functional across different languages.

Repository Information

Analyzed by OSRepos on July 31, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

unicode-slugify is a versatile Python library created by Mozilla, specifically engineered to convert strings, including those with complex Unicode characters, into clean, URL-friendly slugs. This tool was initially developed for the Firefox Add-ons website, where it was crucial for generating slugs for add-ons and collections that frequently contained non-ASCII characters, requiring more sophisticated handling than simple transliteration.

Installation

To integrate unicode-slugify into your Python project, you can easily install it using pip:

pip install unicode-slugify

Examples

The library provides a straightforward API with flexible options to tailor the slug generation to your specific requirements. Here are some common usage patterns:

from slugify import slugify, SLUG_OK

# Default usage: lower, spaces replaced with "-", only alphanum and "-_~" chars, keeps unicode
slugify(u'Bän...g (bang)')
# u'bäng-bang'

# Keep capital letters and spaces
slugify(u'Bän...g (bang)', lower=False, spaces=True)
# u'Bäng bang'

# Replace non-ascii chars with their "best" representation
slugify(u'?? (capital of China)', only_ascii=True)
# u'bei-jing-capital-of-china'

# Allow some extra chars
slugify(u'?? (capital of China)', ok=SLUG_OK+'()', only_ascii=True)
# u'bei-jing-(capital-of-china)'

# "snake_case" example
def snake_case(s):
    # As "-" is not in allowed Chars, first one (`_`) is used for space replacement
    return slugify(s, ok='_', only_ascii=True)
snake_case(u'?? (capital of china)')
# u'bei_jing_capital_of_china'

# "CamelCase" example
def camel_case(s):
    return slugify(s.title(), ok='', only_ascii=True, lower=False)
camel_case(u'?? (capital of china)')
# u'BeiJingCapitalOfChina'

Why Use unicode-slugify?

unicode-slugify stands out due to its robust handling of Unicode characters, a critical feature for applications dealing with international content. Unlike simpler slugifiers, it intelligently processes diverse character sets, ensuring that your slugs remain readable and functional across different languages. Its extensive customization options, including control over ASCII conversion, case, and allowed characters, provide developers with the flexibility needed to generate slugs that perfectly fit their application's specific URL or identifier requirements.

Links

Explore the unicode-slugify repository on GitHub for more details, to contribute, or to report issues:

Related repositories

Similar repositories that may be relevant next.

Python Slugify: Robust Unicode Slug Generation in Python

Python Slugify: Robust Unicode Slug Generation in Python

July 31, 2026

Python Slugify is a powerful Python library designed to create clean, URL-friendly slugs from Unicode strings. It offers extensive customization options, including handling HTML entities, setting max lengths, and defining stopwords. This tool ensures your text is properly formatted for web use, supporting various languages and complex character sets.

pythonslugifyunicode
pyparsing: A Python Library for Creating PEG Parsers

pyparsing: A Python Library for Creating PEG Parsers

July 30, 2026

pyparsing is a Python library that offers an alternative to traditional lex/yacc or regular expressions for creating simple grammars. It allows developers to construct parsers directly in Python code, leveraging a Parsing Expression Grammar (PEG) approach. This library simplifies handling common parsing challenges like whitespace, quoted strings, and embedded comments, making text processing more intuitive.

pythonparsingpeg-parsers
python-nameparser: A Robust Python Module for Parsing Human Names

python-nameparser: A Robust Python Module for Parsing Human Names

July 30, 2026

python-nameparser is a powerful Python module designed to accurately parse human names into distinct components like title, given, middle, family, and suffix. It offers immutable results, flexible configuration, and supports locale-specific parsing, making it an essential tool for text processing and data normalization tasks. The module recently released version 2.0, enhancing its capabilities while maintaining backward compatibility for most existing code.

pythonpython-moduletext-parser
django-wordpress: Integrate WordPress Content into Django

django-wordpress: Integrate WordPress Content into Django

July 29, 2026

django-wordpress provides a robust solution for integrating WordPress content directly into Django applications. It offers read-only models and views, ensuring the safety of your WordPress database while allowing seamless access to posts, pages, and other data. This package is ideal for developers looking to leverage existing WordPress content within a Django framework.

djangowordpresspython

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️