I have the following code:

                otherAlbums = models.Album.objects.filter
(song_album__artist__name=artist).distinct().order_by('releasedate')

when artist contains a unicode value, such as 'El CamarĂ³n de la Isla',
then I receive the following:

Exception Type:         UnicodeEncodeError
Exception Value:        'ascii' codec can't encode character u'\xf3' in
position 8: ordinal not in range(128)
Exception Location:     /usr/lib/python2.5/site-packages/django/utils/
encoding.py in force_unicode, line 53

I've never run across this before.  The project has been in production
for about 2 years.  I've tried 0.96-pre and the 1.02-final versions.
It seems Django doesn't like filtering on a unicode string.


I would appreciate any suggestions you might have on working around
this problem.

Thanks!


The framework location that pukes is here:

/usr/lib/python2.5/site-packages/django/utils/encoding.py in
force_unicode

  46. if strings_only and isinstance(s, (types.NoneType, int, long,
datetime.datetime, datetime.date, datetime.time, float)):
  47. return s
  48. try:
  49. if not isinstance(s, basestring,):
  50. if hasattr(s, '__unicode__'):
  51. s = unicode(s)
  52. else:

  53. s = unicode(str(s), encoding, errors)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to