How to make Django slugify work properly with Unicode strings?

后端 未结 8 1864
猫巷女王i
猫巷女王i 2020-11-28 19:58

What can I do to prevent slugify filter from stripping out non-ASCII alphanumeric characters? (I\'m using Django 1.0.2)

cnprog.com has Chinese character

8条回答
  •  盖世英雄少女心
    2020-11-28 20:12

    This is what I use:

    http://trac.django-fr.org/browser/site/trunk/djangofr/links/slughifi.py

    SlugHiFi is a wrapper for regular slugify, with a difference that it replaces national chars with their English alphabet counterparts.

    So instead of "Ą" you get "A", instead of "Ł" => "L", and so on.

提交回复
热议问题