[Answered ]-Django rest framework does not show utf8 words

0👍

Anyway , when i see json in the chrome +33 , response does not show utf8 word but when i see response in the Firefox every thing is Ok , and when i parse the Json every thing is Ok .

👤majid

1👍

The problem is with self.title.encode('utf8'). Seems like your are using python 2. The encode() function converts string to bytes. That’s why title is getting weird. Since you are already importing unicode_literals from __future__, all the string will be unicode. Just return self.title that would solve the problem.. For more info https://docs.python.org/2/howto/unicode.html

1👍

Ensure that u assign correct encoding to http header so browser will recognize encoding of data.
Example below show how u can identify it using Developer Tool in Firefox. Same tools exists in Chrome . If u clearly will not assign encoding in header then browser will try guest or use default to encode data from server.

enter image description here

👤simar

Leave a comment