Ticket #13139: patch.diff

File patch.diff, 670 bytes (added by megaman821, 9 years ago)
  • apps/django/forms/fields.py

    a b  
    147147        super(CharField, self).clean(value)
    148148        if value in EMPTY_VALUES:
    149149            return u''
    150         value = smart_unicode(value)
     150        try:
     151            value = smart_unicode(value)
     152        except UnicodeDecodeError, e:
     153            raise ValidationError(e)
    151154        value_length = len(value)
    152155        if self.max_length is not None and value_length > self.max_length:
    153156            raise ValidationError(self.error_messages['max_length'] % {'max': self.max_length, 'length': value_length})
Back to Top