{"name":"unicode-slugify: A Robust Python Slugifier for Unicode Strings","description":"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","url":"https://osrepos.com/repo/mozilla-unicode-slugify","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/mozilla-unicode-slugify","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/mozilla-unicode-slugify.md","json":"https://osrepos.com/repo/mozilla-unicode-slugify.json","topics":["python","slugifier","unicode","web-development","utility","mozilla","open-source"],"keywords":["python","slugifier","unicode","web-development","utility","mozilla","open-source"],"stars":null,"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.","content":"## Introduction\n\n`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.\n\n## Installation\n\nTo integrate `unicode-slugify` into your Python project, you can easily install it using pip:\n\nbash\npip install unicode-slugify\n\n\n## Examples\n\nThe library provides a straightforward API with flexible options to tailor the slug generation to your specific requirements. Here are some common usage patterns:\n\npython\nfrom slugify import slugify, SLUG_OK\n\n# Default usage: lower, spaces replaced with \"-\", only alphanum and \"-_~\" chars, keeps unicode\nslugify(u'Bän...g (bang)')\n# u'bäng-bang'\n\n# Keep capital letters and spaces\nslugify(u'Bän...g (bang)', lower=False, spaces=True)\n# u'Bäng bang'\n\n# Replace non-ascii chars with their \"best\" representation\nslugify(u'?? (capital of China)', only_ascii=True)\n# u'bei-jing-capital-of-china'\n\n# Allow some extra chars\nslugify(u'?? (capital of China)', ok=SLUG_OK+'()', only_ascii=True)\n# u'bei-jing-(capital-of-china)'\n\n# \"snake_case\" example\ndef snake_case(s):\n    # As \"-\" is not in allowed Chars, first one (`_`) is used for space replacement\n    return slugify(s, ok='_', only_ascii=True)\nsnake_case(u'?? (capital of china)')\n# u'bei_jing_capital_of_china'\n\n# \"CamelCase\" example\ndef camel_case(s):\n    return slugify(s.title(), ok='', only_ascii=True, lower=False)\ncamel_case(u'?? (capital of china)')\n# u'BeiJingCapitalOfChina'\n\n\n## Why Use unicode-slugify?\n\n`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.\n\n## Links\n\nExplore the `unicode-slugify` repository on GitHub for more details, to contribute, or to report issues:\n\n*   [GitHub Repository](https://github.com/mozilla/unicode-slugify){:target=\"_blank\"}","metrics":{"detailViews":0,"githubClicks":1},"dates":{"published":null,"modified":"2026-07-31T11:18:53.000Z"}}