WebFaction
Community site: login faq

I'm using Django 1.3 and python 2.7 on this app. and it returns DjangoUnicodeDecodeError every time I try to delete an entry that's in arabic.

Here's the full error stack.

Traceback (most recent call last):

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/options.py", line 307, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/decorators.py", line 93, in _wrapped_view
    response = view_func(request, *args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/views/decorators/cache.py", line 79, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/sites.py", line 197, in inner
    return view(request, *args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/decorators.py", line 28, in _wrapper
    return bound_func(*args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/decorators.py", line 93, in _wrapped_view
    response = view_func(request, *args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/decorators.py", line 24, in bound_func
    return func(self, *args2, **kwargs2)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/db/transaction.py", line 217, in inner
    res = func(*args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/options.py", line 1201, in delete_view
    [obj], opts, request.user, self.admin_site, using)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/util.py", line 104, in get_deleted_objects
    to_delete = collector.nested(format_callback)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/util.py", line 158, in nested
    roots.extend(self._nested(root, seen, format_callback))

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/util.py", line 143, in _nested
    ret = [format_callback(obj)]

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/contrib/admin/util.py", line 97, in format_callback
    escape(obj)))

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/functional.py", line 259, in wrapper
    return func(*args, **kwargs)

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/html.py", line 34, in escape
    return mark_safe(force_unicode(html).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'", '&#39;'))

  File "/home/ibag/webapps/startpdb/lib/python2.7/django/utils/encoding.py", line 93, in force_unicode
    raise DjangoUnicodeDecodeError(s, *e.args)

DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 0: ordinal not in range(128). You passed in <IdeathonSubmission: [Bad Unicode data]> (<class 'arabnet.startupdb.models.IdeathonSubmission'>)

asked 30 Dec '13, 10:26

dado_eyad
111
accept rate: 0%


You may be dealing with a database UTF-8 collation issue. Please take a look at these:

http://stackoverflow.com/questions/2168816/django-headache-with-simple-non-ascii-string

http://www.factory-h.com/blog/?p=56

permanent link

answered 30 Dec '13, 13:46

likebike
3366
accept rate: 28%

edited 30 Dec '13, 13:48

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×8
×7

question asked: 30 Dec '13, 10:26

question was seen: 3,366 times

last updated: 30 Dec '13, 13:48

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM