I'm using django's import_export lib. But when I'm importing my json file I'm receiving the following error
Imported file has a wrong encoding: 'charmap' codec can't decode byte 0x81 in position 1602: character maps to
I've found similar questions but they don't conver django import_export.
My json file contains arabic caracters and ascii caracters. Here's a json object from it :
{"id":"35","code":"35","name_fr":"Boumerd\u00e8s","name_ar":"بومرداس"}
Here's my import_export class where I'm precising utf-8 encoding
class SpecAdmin(ImportExportActionModelAdmin):
from_encoding = 'utf-8'
def get_instance(self, instance_loader, row):
try:
params = {}
for key in instance_loader.resource.get_import_id_fields():
field = instance_loader.resource.fields[key]
params[field.attribute] = field.clean(row)
return self.get_queryset().get(**params)
except Exception:
return None
If anyone had a similar problem with this library can you please tell me what I'm doing wrong.