python3: encoding variations in csv importer
This commit is contained in:
parent
39934817e9
commit
ef91498e6a
|
@ -28,6 +28,7 @@ from django.core.validators import RegexValidator
|
|||
from django.db import IntegrityError
|
||||
from django.db.transaction import atomic
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from django_rbac.utils import get_role_model
|
||||
|
@ -120,7 +121,7 @@ class CsvImporter(object):
|
|||
|
||||
def parse_csv():
|
||||
try:
|
||||
content = input_fd.read().encode('utf-8')
|
||||
content = force_text(input_fd.read().encode('utf-8'))
|
||||
except UnicodeDecodeError:
|
||||
self.error = Error('bad-encoding', _('Bad encoding'))
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue