Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)
Accept a unicode string, and return a normal string (bytes in Python 3)
without any diacritical marks.

        def remove_diacritic(input):
    '''
    Accept a unicode string, and return a normal string (bytes in Python 3)
    without any diacritical marks.
    '''
    return unicodedata.normalize('NFKD', input).encode('ASCII', 'ignore')
        


src/d/j/django-orm-extensions-3.0b3/django_orm/sqlite3/extra_functions.py   django-orm-extensions(Download)
# -*- coding: utf-8 -*-
 
from django.db import connections, DEFAULT_DB_ALIAS
from django_orm.utils import remove_diacritic
 
import functools
 
def _sqlite_unaccent(data):
    if isinstance(data, basestring):
        return remove_diacritic(data)

src/d/j/django-orm-extensions-3.0b3/django_orm/postgresql/expressions.py   django-orm-extensions(Download)
# -*- coding: utf-8 -*-
 
from django_orm.core.sql import SqlExpression
from django_orm.utils import remove_diacritic
 
    def __init__(self, field, value):
        super(UnaccentExpression, self)\
            .__init__(Unaccent(self.field), "LIKE", u"%%%s%%" % remove_diacritic(term))
 

src/d/j/django-orm-2.0.5/django_orm/backends/sqlite3/pool.py   django-orm(Download)
def _sqlite_unaccent(data):
    if isinstance(data, unicode):
        from django_orm.utils import remove_diacritic
        return remove_diacritic(data)
    return data