#3387: UnicodeEncodeError on contains and icontains
-----------------------+----------------------------------------------------
Reporter:  Gacha       |       Owner:  adrian            
  Status:  new         |   Component:  Core framework    
 Version:  SVN         |    Keywords:  UnicodeEncodeError
   Stage:  Unreviewed  |   Has_patch:  0                 
-----------------------+----------------------------------------------------
 I got UnicodeEncodeError when I try to search with "__icontains" and
 unicode string.
 
 {{{
 In [26]: Product.objects.filter(name=unicode('Fantasia - ķiršu','utf-8'))
 Out[26]: [<Product: Fantasia - ķiršu>]
 
 In [27]: Product.objects.filter(name__icontains=unicode('Fantasia -
 ķiršu','utf-8'))
 ---------------------------------------------------------------------------
 exceptions.UnicodeEncodeError                        Traceback (most
 recent call last)
 ............
 /home/***/django/db/models/fields/__init__.py in <lambda>(x)
      23
      24 # prepares a value for use in a LIKE query
 ---> 25 prep_for_like_query = lambda x: str(x).replace("\\",
 "\\\\").replace("%", "\%").replace("_", "\_")
      26
      27 # returns the <ul> class for a given radio_admin value
 
 UnicodeEncodeError: 'ascii' codec can't encode character u'\u0137' in
 position 11: ordinal not in range(128)
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3387>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to