I've got a problem with the command loaddata
of my Django app.
When I run this command, this UnicodeDecodeError
appears because of the "é" that are in my database table.
i've try with many type of database on pgAdmin with different encode type like "UTF-8", "latin-1" or "win1252" or different "character type" or "collation" settings like "C" or "french_switzerland.1252" but every time there is this error.
Here is more information about my work space.
Let me know if you need more informations, I don't give you too much, I don't want to give useless information.
I know there are other questions which look similar to mine but I don't understand the answers. There are explanations about why there is the error but not about how to solve it.
- I am on Windows 10
- I'm using Pycharm 2020.3.2
- Pgadmin v4
the complete error :
(venv) C:UsersMathiasPycharmProjectsyufindProject>python manage.py loaddata ask/dumps/ask.json
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagement\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagement\__init__.py", line 395, in execut
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagementase.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagementase.py", line 371, in execute
output = self.handle(*args, **options)
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagementcommandsloaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagementcommandsloaddata.py", line 114, in loaddata
self.load_label(fixture_label)
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoremanagementcommandsloaddata.py", line 172, in load_label
for obj in objects:
File "C:UsersMathiasPycharmProjectsyufindProjectvenvlibsite-packagesdjangocoreserializersjson.py", line 67, in Deserializer
stream_or_string = stream_or_string.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 460: invalid continuation byte
question from:
https://stackoverflow.com/questions/65859731/unicodedecodeerror-utf-8-codec-cant-decode-byte-0xe9-in-position-460-invali 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…