Changes between Version 1 and Version 2 of Ticket #21729, comment 2


Ignore:
Timestamp:
Feb 9, 2015, 7:23:27 AM (9 years ago)
Author:
Mattias Lindvall

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21729, comment 2

    v1 v2  
    3333django.utils.encoding.DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 29: unexpected end of data. You passed in 'The Chesterfield brand Stor h\xc3' (<type 'str'>)
    3434}}}
     35
     36And here is my current workaround:
     37{{{
     38class MyForm(forms.Form):
     39    def _clean_fields(self, *args, **kwargs):
     40        try:
     41            return super(FeedRowForm, self)._clean_fields(*args, **kwargs)
     42        except DjangoUnicodeDecodeError:
     43            msg = "The data you povided is not encoded properly, please ensure you have valid UTF-8."
     44            self._errors['__all__'] = self.error_class([msg])
     45
     46}}}
Back to Top