C
C
Cyber_bober2016-04-12 14:10:59
Django
Cyber_bober, 2016-04-12 14:10:59

How to fix an encoding error when adding data from the admin panel?

Hello, I copy the text from another site and paste it into the field in the admin panel, I get it when I add
'utf8' codec can't decode byte 0xd0 in position 0
it. I copy the same text from the sublime - everything is in order, everywhere the encoding is utf-8.
What could be the reason? Can't use 3.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kozlov, 2016-04-12
@gravizappa

Try to make unicode(str, errors='ignore') or unicode(str, errors='replace') to the string in the model presave. And check if the site has utf-8 encoding set when viewing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question