Opened 18 years ago

Last modified 15 years ago

#3924 closed

Caught an exception while rendering: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128) — at Version 3

Reported by: ruben.perez@… Owned by: hugo
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: jm.bugtracking@…, antoni.aloy@…, mpjung@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Malcolm Tredinnick)

Hello, after update the django code from svn, my admin site doesn´t work. The error is : Caught an exception while rendering: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128).

My models.py has a correct coding declaration, it is # -*- coding: UTF-8 -*-. My admin site allways works with previous svn revisions but it doesn´t work with the latest revision 4926 from the developer code. I´m working with language-code "es-es".

The problem is related with the use of non-ascii characters as the return value of __str__ with models.ForeignKey and models.ManyToManyField.

Thank you very much.

Below you can find a piece of code.

UnicodeDecodeError at /admin/articulos/articulo/add/
'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128)
Request Method: 	GET
Request URL: 	http://www..../admin/articulos/articulo/add/
Exception Type: 	UnicodeDecodeError
Exception Value: 	'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128)
Exception Location: 	/home/rubenper/django/django/oldforms/__init__.py in render, line 490
Template error

In template /home/rubenper/django/django/contrib/admin/templates/widget/foreign.html, error at line 2
Caught an exception while rendering: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128)
1 	{% load admin_modify adminmedia %}
2 	{% output_all bound_field.form_fields %}

Change History (3)

comment:1 by anonymous, 18 years ago

Resolution: invalid
Status: newclosed

comment:2 by anonymous, 18 years ago

Resolution: invalid
Status: closedreopened

Hi, I reopen this bug because the problem persists.

The problem is related with this:

http://code.djangoproject.com/changeset?new=django%404919&old=django%404918

Version 4918 works
Version 4919 doesn´t work

I often use words like "Asociación" for example, and with version 4919 or newer, non-ascii characters don´t work.

html = str(html) change to html = smart_unicode(html)

Thank You

I´m sorry but I´m a newbie and I don´t know how to resolve it.

comment:3 by Malcolm Tredinnick, 18 years ago

Description: modified (diff)

Fixed formatting in description.

Note: See TracTickets for help on using tickets.
Back to Top