Answer the question
In order to leave comments, you need to log in
Problem with Python(Django) encoding?
Good afternoon guys.
There was an encoding problem in Django.
Here's the thing, the input function receives data from the mongodb database and should return this string, which will be displayed on the site page.
String in mongodb: "Stretch fabric piqué polo"
String returned by the function: "Stretch fabric piqu\xe9 polo"
Here's how to make the function return the first option, and not the second?
My failed attempts:
1. return u'%s' % str(value)
2. from django.utils.safestring import SafeUnicode
return SafeUnicode(str(value))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question