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.

nanobot: An Ultra-Lightweight, Self-Hosted Personal AI Agent Framework

nanobot: An Ultra-Lightweight, Self-Hosted Personal AI Agent Framework

August 9, 2026

nanobot is an ultra-lightweight, open-source, self-hosted personal AI agent framework built in Python. It offers a WebUI, tools, memory, multi-agent workflows, and automation capabilities, making it a versatile solution for personal AI tasks. Users can deploy it across various platforms, including chat apps, for seamless integration.

ai-agentagent-frameworkpython
ReMe: An Advanced Memory Management Kit for AI Agents

ReMe: An Advanced Memory Management Kit for AI Agents

August 7, 2026

ReMe is an innovative, local-first memory layer designed for AI agents, transforming conversations and resources into file-based long-term memory. It continuously indexes, links, and consolidates this information, enabling advanced recall and supporting the development of self-evolving agents. This kit helps agents remember and refine their experiences effectively.

agentai-agentsmemory
code-review-graph: AI-Powered Code Intelligence for Smarter Reviews

code-review-graph: AI-Powered Code Intelligence for Smarter Reviews

August 6, 2026

code-review-graph is a local-first code intelligence graph that optimizes AI coding tools by building a persistent map of your codebase. It significantly reduces context for AI reviews and large-repo workflows, ensuring AI assistants read only the most relevant code. This leads to more efficient and cost-effective code analysis.

ai-codingcode-reviewknowledge-graph
Nikola: A Powerful Static Website and Blog Generator

Nikola: A Powerful Static Website and Blog Generator

August 6, 2026

Nikola is an open-source static website and blog generator written in Python. It transforms content into a deployable website, offering a secure and resource-efficient alternative to dynamic sites. With features like theming, fast builds, and multilingual support, Nikola is a versatile tool for web development.

pythonstatic-sitestatic-site-generator

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 ❤️