Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4886 closed (invalid)

Unicode Error

Reported by: BBB Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: Keywords: unicode, fixtures, utf-8
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

I have save my fixtures files in UTF-8. And when I try to see the data in admin interface, I have this error message :

UnicodeEncodeError at /admin/annonces/annonce/add/
'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/annonces/annonce/add/
Exception Type: UnicodeEncodeError
Exception Value: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)
Exception Location: C:\django_unicode\django\utils\encoding.py in force_unicode, line 40
Python Executable: C:\Python25\python.exe
Python Version: 2.5.0

Traceback (most recent call last):
File "C:\django_unicode\django\core\handlers\base.py" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "C:\django_unicode\django\contrib\admin\views\decorators.py" in _checklogin

  1. return view_func(request, *args, kwargs)

File "C:\django_unicode\django\views\decorators\cache.py" in _wrapped_view_func

  1. response = view_func(request, *args, kwargs)

File "C:\django_unicode\django\contrib\admin\views\main.py" in add_stage

  1. manipulator = model.AddManipulator()

File "C:\django_unicode\django\db\models\manipulators.py" in init

  1. self.fields.extend(f.get_manipulator_fields(self.opts, self, self.change))

File "C:\django_unicode\django\db\models\fields\init.py" in get_manipulator_fields

  1. field_objs, params = self.prepare_field_objs_and_params(manipulator, name_prefix)

File "C:\django_unicode\django\db\models\fields\related.py" in prepare_field_objs_and_params

  1. paramschoices = self.get_choices_default()

File "C:\django_unicode\django\db\models\fields\init.py" in get_choices_default

  1. return self.get_choices()

File "C:\django_unicode\django\db\models\fields\init.py" in get_choices

  1. lst = [(getattr(x, self.rel.get_related_field().attname), smart_unicode(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]

File "C:\django_unicode\django\utils\encoding.py" in smart_unicode

  1. return force_unicode(s, encoding, strings_only, errors)

File "C:\django_unicode\django\utils\encoding.py" in force_unicode

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

UnicodeEncodeError at /admin/annonces/annonce/add/
'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)

I use SVN trunk version and I have the same error with Unicode branche.

Change History (2)

comment:1 by Jorge Gajon <gajon@…>, 17 years ago

Cc: unicode removed
Resolution: invalid
Status: newclosed

The Unicode branch has already been merged into Trunk. Please follow carefully the porting steps that are explained here:

http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist

You are probably seeing that error because you haven't changed your models' __str__ methods to __unicode__.

If you still have problems, please bring your question to the Django-Users mailing list:
http://groups.google.com/group/django-users/

comment:2 by BBB, 17 years ago

Yes I forgot to change str to unicode.
Thanks for fast answer :)

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