Hi Daniel, My databse enconding (Mysql) is utf-8, as you can see below:
Server characterset: latin1 Db characterset: utf8 Client characterset: latin1 Conn. characterset: latin1 There is something strange, because I'm showing the same information on my page and I'm not getting that error that I showed before. The difference is that in my page I put <meta http-equiv="content-type" content="text/html; charset=utf-8" /> (without this I get the error) My model code It's just mapping the database fields to python code, just like this: (the class and variable names are in Portuguese) Is it missing something? *from django.db import models class PresenteRecebido(models.Model): nome_convidado = models.CharField(max_length=60) data_recebimento = models.DateField() email = models.EmailField() descricao_presente = models.CharField(max_length=300) ip = models.CharField(max_length=100) def __str__(self): return self.nome_convidado + " - " + self.descricao_presente* On Tue, Jul 21, 2009 at 10:05 AM, Daniel Roseman <dan...@roseman.org.uk>wrote: > > On Jul 21, 1:27 pm, Rodrigo Gomes <rgo...@gmail.com> wrote: > > Hi, > > > > I'm getting the error below when i'm trying to edit a non ascii value on > the > > admin site. > > I tried to put # -*- coding: utf-8 -*- on my model file, tried to set > > settings.FILE_CHARSET to 'utf-8' and I tried to put > > <meta http-equiv="content-type" content="text/html; charset=utf-8" /> on > the > > admin page "change.form.html", but it didn't work. > > > > Is there something that I forgot to do? Google didn't help me so > much...In > > fact, I don't know how to search =/ > > > > Can you help me with this? > > > > Exception Value: > > > > Caught an exception while rendering: 'ascii' codec can't encode > > character u'\xed' in position 9: ordinal not in range(128) > > > > Original Traceback (most recent call last): > > File "/Library/Python/2.5/site-packages/django/template/debug.py", > > line 71, in render_node > > > > result = node.render(context) > > File "/Library/Python/2.5/site-packages/django/template/debug.py", > > line 87, in render > > output = force_unicode(self.filter_expression.resolve(context)) > > File "/Library/Python/2.5/site-packages/django/template/__init__.py", > > line 559, in resolve > > > > new_obj = func(obj, *arg_vals) > > File > "/Library/Python/2.5/site-packages/django/template/defaultfilters.py", > > line 38, in _dec > > args[0] = force_unicode(args[0]) > > File "/Library/Python/2.5/site-packages/django/utils/encoding.py", > > line 52, in force_unicode > > > > s = unicode(str(s), encoding, errors) > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in > > position 9: ordinal not in range(128) > > > > Thanks, > > Rodrigo Gomes > > What encoding do your database and table have? > Also, it would help to post your model code - you may have a method > that's not returning unicode when it should be. > -- > DR. > > > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---