Unicodeencodeerror: 'ascii' Codec Can't Encode Character U'\xc5' In Position 35: Ordinal Not In Range(128)
I am currently using Django-countries to get a list of ISO country names for a form field. It displays without error on my website, but on Django's Admin site it causes the aforeme
Solution 1:
Add this to your model:
@python_2_unicode_compatibleclassThread(models.Model):
...
and update the str method of this class to:
classTour(models.Model):
...
def__str__(self):
return"{0} by {1}".format(self.tour_name.encode('utf8'), self.tour_guide)
You also need to be sure the representation of UserProfile is encoded to utf8
Solution 2:
try this: (u"" from unicode strings) i think it might be the problem
def__str__(self):
returnu"{0} by {1}".format(self.tour_name, self.tour_guide)
Post a Comment for "Unicodeencodeerror: 'ascii' Codec Can't Encode Character U'\xc5' In Position 35: Ordinal Not In Range(128)"