Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4886 closed (invalid)

Unicode Error

Reported by: BBB Owned by: adrian
Component: Core (Other) Version: master
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: UI/UX:



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:
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\ 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\" in get_response

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

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

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

File "C:\django_unicode\django\views\decorators\" in _wrapped_view_func

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

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

  1. manipulator = model.AddManipulator()

File "C:\django_unicode\django\db\models\" in init

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

File "C:\django_unicode\django\db\models\fields\" 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\" in prepare_field_objs_and_params

  1. paramschoices? = self.get_choices_default()

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

  1. return self.get_choices()

File "C:\django_unicode\django\db\models\fields\" 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\" in smart_unicode

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

File "C:\django_unicode\django\utils\" 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.

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by Jorge Gajon <gajon@…>

  • Cc unicode removed
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

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:

comment:2 Changed 7 years ago by BBB

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

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.