I am getting an Incorrect string value (Exception Value: Incorrect string value: '\xEA\xB0\x95\xED\x95\x98...' for column 'object_repr' at row 1) error while trying to save unicode string (Korean) in Django and MySQL.First problem I had was "Incorrect string value" error for each column in the database table. However, I figured this out by changing column collation and overall database character set.
The new error I am getting is related to unicode(self) method in models.py.My models.py is as the following:
from django.db import models
# Create your models here.
class User(models.Model):
full_name = models.CharField(max_length=60)
email = models.EmailField(unique=True)
password = models.CharField(max_length=128)
birthday = models.DateField(null=True, blank=True)
gender = models.PositiveIntegerField(null=True, blank=True)
location = models.CharField(max_length=60, null=True, blank=True)
captcha = models.CharField(max_length=60, null=True, blank=True)
register_date = models.DateTimeField()
lastLogin_date = models.DateTimeField(null=True)
num_logins = models.PositiveIntegerField()
def __unicode__(self):
return self.full_name
The error is generated when the__unicode__ function tries to output utf8 character...
Does anybody know how to fix this error?
smart_unicodeutility toself.full_name(docs.djangoproject.com/en/dev/ref/unicode/#conversion-functions) ?