Opened 13 years ago
Closed 13 years ago
#16853 closed Bug (duplicate)
Slugify removes dotless "i"
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Template system | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | yasar11732@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
As a Turkish Django user, I need to use slugify with strings containing Turkish dotless i. As most Turkish developers, I also expect it to convert that character to ascii "i", however, It just disappears in resulting string. As for now, I am using a workaround I have found in here: http://gokmengorgen.net/post/detail/djangoda-turkce-destekli-slugify/
Here is the workaround I currently use:
def slugify_unicode(value): value = value.replace(u'\u0131', 'i') value = normalize('NFKD', value).encode('ascii', 'ignore') value = unicode(sub('[^\w\s-]', '', value).strip().lower()) return sub('[-\s]+', '-', value)
Note:
See TracTickets
for help on using tickets.
This seems more of a specific case of #8391, it would be worth adding your notes to that ticket. There are several approaches on that ticket that try to solve this problem more generally