Re: Django + Russian Charaters
On Thu, Dec 2, 2010 at 2:24 AM, pROCKrammer <prockrammer@gmail.com> wrote:
Hi, I am getting such error while adding text with russian charaters
from the admin panel, Please help me
The Model is
class JobTitle (models.Model):
# Char Fields
title = models.CharField(max_length = 250)
def __unicode__(self):
return u'%s' % (self.title) # Tried return self.title before, also
Tried force_unicode
Warning at /admin/hrm/jobtitle/add/
Incorrect string value: '\xD1\x84\xD1\x8B\xD0\xB2...' for column
'object_repr' at row 1Request Method: POST
Request URL: http://localhost:8000/admin/hrm/jobtitle/add/
Django Version: 1.2.3
Exception Type: Warning
Exception Value: Incorrect string value: '\xD1\x84\xD1\x8B
\xD0\xB2...'
for column 'object_repr' at row 1
I'd guess your table encoding is latin1 (the MySQL default). These Russian characters have no representation in latin1 so MySQL reports "Incorrect string value" on an attempt to store them in the table. If you want to be able to store characters outside the range of what latin1 can represent, then you need to tell MySQL to use an encoding such as utf-8 which is capable of representing them. See: http://docs.djangoproject.com/en/dev/ref/databases/#creating-your-database for how to create a new database with a utf-8 character set; consult the MySQL documentation if you want to convert the tables you have to use utf-8 -- you will want the ALTER TABLE command with CONVERT TO CHARACTER SET option.
Karen
http://tracey.org/kmt/
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home