Hello all,

I get the following error:
----
In [2]: from myapp.models import *

In [3]: Mymodel.objects.all()
Out[3]:
---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call
last)

/home/user/myproject/<ipython console> in <module>()

/var/lib/python-support/python2.5/IPython/Prompts.pyc in
__call__(self, arg)
    549
    550             # and now call a possibly user-defined print
mechanism
--> 551             manipulated_val = self.display(arg)
    552
    553             # user display hooks can change the variable to be
stored in

/var/lib/python-support/python2.5/IPython/Prompts.pyc in
_display(self, arg)
    575             return IPython.generics.result_display(arg)
    576         except TryNext:
--> 577             return self.shell.hooks.result_display(arg)
    578
    579     # Assign the default display method:

/var/lib/python-support/python2.5/IPython/hooks.pyc in __call__(self,
*args, **kw)
    133             #print "prio",prio,"cmd",cmd #dbg
    134             try:
--> 135                 ret = cmd(*args, **kw)
    136                 return ret
    137             except ipapi.TryNext, exc:

/var/lib/python-support/python2.5/IPython/hooks.pyc in
result_display(self, arg)
    163
    164     if self.rc.pprint:
--> 165         out = pformat(arg)
    166         if '\n' in out:
    167             # So that multi-line strings line up with the left
column of

/usr/lib/python2.5/pprint.pyc in pformat(self, object)
    109     def pformat(self, object):
    110         sio = _StringIO()
--> 111         self._format(object, sio, 0, 0, {}, 0)
    112         return sio.getvalue()
    113

/usr/lib/python2.5/pprint.pyc in _format(self, object, stream, indent,
allowance, context, level)
    127             self._readable = False
    128             return
--> 129         rep = self._repr(object, context, level - 1)
    130         typ = _type(object)
    131         sepLines = _len(rep) > (self._width - 1 - indent -
allowance)

/usr/lib/python2.5/pprint.pyc in _repr(self, object, context, level)
    193     def _repr(self, object, context, level):
    194         repr, readable, recursive = self.format(object,
context.copy(),
--> 195                                                 self._depth,
level)
    196         if not readable:
    197             self._readable = False

/usr/lib/python2.5/pprint.pyc in format(self, object, context,
maxlevels, level)
    205         and whether the object represents a recursive
construct.
    206         """
--> 207         return _safe_repr(object, context, maxlevels, level)
    208
    209

/usr/lib/python2.5/pprint.pyc in _safe_repr(object, context,
maxlevels, level)
    290         return format % _commajoin(components), readable,
recursive
    291
--> 292     rep = repr(object)
    293     return rep, (rep and not rep.startswith('<')), False
    294

/usr/lib/python2.5/site-packages/django/db/models/query.pyc in
__repr__(self)
    139
    140     def __repr__(self):
--> 141         return repr(list(self))
    142
    143     def __len__(self):

/usr/lib/python2.5/site-packages/django/db/models/base.pyc in
__repr__(self)
    242
    243     def __repr__(self):
--> 244         return smart_str(u'<%s: %s>' %
(self.__class__.__name__, unicode(self)))
    245
    246     def __str__(self):

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
6: ordinal not in range(128)
----
In Mymodel table there are strings with accents like "construcción".
This table have been created by syncdb as " DEFAULT CHARSET=latin1;".
I've probed to alter the table to  " DEFAULT CHARSET=utf8" but still
get the same error.

In the settings.py file  I have:
DATABASE_OPTIONS = {'use_unicode': True, 'charset': 'utf8',
"init_command": "SET storage_engine=INNODB", "init_command": "set
names utf8","init_command": "SET character_set_database=utf8",
"init_command": "SET character_set_client=utf8"
}
#DATABASE_OPTIONS = {'use_unicode': False}
FILE_CHARSET = 'utf8'
DEFAULT_CHARSET = 'utf8'
DATABASE_CHARSET =  'utf8'

My django version is the latest svn trunk. Mysql version is 5.

What could I do to solve the problem?.

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to