Code

Opened 3 years ago

Closed 3 years ago

#16853 closed Bug (duplicate)

Slugify removes dotless "i"

Reported by: yasar11732@… 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)

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by ptone

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.