Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 2, 2010 07:24:24

p.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django + Russian Charaters


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
Exception Location: /usr/lib/pymodules/python2.6/MySQLdb/
cursors.py in
_warning_check, line 82
Python Executable: /usr/bin/python
Python Version: 2.6.6

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 2, 2010 12:56:48

Karen T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django + Russian Charaters


On Thu, Dec 2, 2010 at 2:24 AM, pROCKrammer <prockram...@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-databaseforhow 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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support