# unicode-slugify: A Robust Python Slugifier for Unicode Strings

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

Source: osrepos.com
Repository profile: https://osrepos.com/repo/mozilla-unicode-slugify
Generated for open source discovery and AI-assisted research.

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.

GitHub: https://github.com/mozilla/unicode-slugify
OSRepos URL: https://osrepos.com/repo/mozilla-unicode-slugify

## 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.

## Topics

- python
- slugifier
- unicode
- web-development
- utility
- mozilla
- open-source

## Repository Information

Last analyzed by OSRepos: Fri Jul 31 2026 12:18:53 GMT+0100 (Western European Summer Time)
Detail views: 0
GitHub clicks: 1

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## 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:

bash
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:

python
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:

*   [GitHub Repository](https://github.com/mozilla/unicode-slugify){:target="_blank"}