Still something wrong with character set.

When I use Russian characters inside value of a field in one table,
Django admin interface can't show list of object corresponding to that
table. Like I'm trying to access http://test.legalsw.ru/admin/menu/item/
and getting:
TemplateSyntaxError at /admin/menu/item/

Caught an exception while rendering: 'ascii' codec can't decode byte
0xd0 in position 0: ordinal not in range(128). You passed in
<django.utils.encoding.DjangoUnicodeDecodeError instance at 0x9ffe06c>
(<type 'instance'>)

Original Traceback (most recent call last):
  File "/home/l/legalswru/test/public_html/django/template/debug.py",
line 71, in render_node
    result = node.render(context)
  File "/home/l/legalswru/test/public_html/django/template/
loader_tags.py", line 24, in render
    result = self.nodelist.render(context)
  File "/home/l/legalswru/test/public_html/django/template/
__init__.py", line 768, in render
    bits.append(self.render_node(node, context))
  File "/home/l/legalswru/test/public_html/django/template/debug.py",
line 78, in render_node
    wrapped = TemplateSyntaxError(u'Caught an exception while
rendering: %s' % force_unicode(e, errors='replace'))
  File "/home/l/legalswru/test/public_html/django/utils/encoding.py",
line 70, in force_unicode
    raise DjangoUnicodeDecodeError(s, *e.args)
DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in
position 0: ordinal not in range(128). You passed in
<django.utils.encoding.DjangoUnicodeDecodeError instance at 0x9ffe06c>
(<type 'instance'>)

Request Method:         GET
Request URL:    http://test.legalsw.ru/admin/menu/item/
Exception Type:         TemplateSyntaxError
Exception Value:

Caught an exception while rendering: 'ascii' codec can't decode byte
0xd0 in position 0: ordinal not in range(128). You passed in
<django.utils.encoding.DjangoUnicodeDecodeError instance at 0x9ffe06c>
(<type 'instance'>)

Original Traceback (most recent call last):
  File "/home/l/legalswru/test/public_html/django/template/debug.py",
line 71, in render_node
    result = node.render(context)
  File "/home/l/legalswru/test/public_html/django/template/
loader_tags.py", line 24, in render
    result = self.nodelist.render(context)
  File "/home/l/legalswru/test/public_html/django/template/
__init__.py", line 768, in render
    bits.append(self.render_node(node, context))
  File "/home/l/legalswru/test/public_html/django/template/debug.py",
line 78, in render_node
    wrapped = TemplateSyntaxError(u'Caught an exception while
rendering: %s' % force_unicode(e, errors='replace'))
  File "/home/l/legalswru/test/public_html/django/utils/encoding.py",
line 70, in force_unicode
    raise DjangoUnicodeDecodeError(s, *e.args)
DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in
position 0: ordinal not in range(128). You passed in
<django.utils.encoding.DjangoUnicodeDecodeError instance at 0x9ffe06c>
(<type 'instance'>)

Exception Location:     /home/l/legalswru/test/public_html/django/
template/debug.py in render_node, line 81
Python Executable:      /usr/bin/python
Python Version:         2.4.4
Python Path:    ['/home/l/legalswru/test/public_html', '/home/l/
legalswru/test/public_html', '/usr/lib/python24.zip', '/usr/lib/
python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-
tk', '/usr/lib/python2.4/lib-dynload', '/usr/lib/portage/pym', '/usr/
lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/PIL']
Server time:    Чет, 18 Сен 2008 07:10:34 -0500

I understand that this is most probably misconfiguration of mysql, but
I've tried a lot of different configurations using init_command,
charset, use_unicode and read_default_file parameters... I've also
tried to reconfigure database to use cp1251 charset, because this is
default encoding for mysql server, but without positive effect... The
only difference I can see is a modification of the byte which is 0xd0
in above error report.

Sorry for my bad English, but I really need any fresh ideas!

On Sep 18, 12:29 pm, Fedya <[EMAIL PROTECTED]> wrote:
> hm... I've tried with very simple model from the scratch and I got the
> same problem without init_command...
>
> On Sep 18, 2:30 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Thu, 2008-09-18 at 01:57 +0300, Fedor Tyurin wrote:
> > > Another possible solution (and probably better one) is to use
> > > init_command option set to 'SET NAMES utf8'.
>
> > Django and MySQLdb already do this by default. Django passes the
> > "charset='utf-8'" parameter to the connection and MySQLdb turns this
> > into a "SET NAMES" call. So you're doing something unusual if this isn't
> > working by default.
>
> > Regards,
> > Malcolm
--~--~---------~--~----~------------~-------~--~----~
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