#20251: UnicodeEncodeError with DecimalField ----------------------------+-------------------- Reporter: anonymous | Owner: nobody Type: Bug | Status: new Component: Forms | Version: 1.5 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------+-------------------- My form: {{{ class TestForm(forms.Form): value = forms.DecimalField()
}}} When enteing "1 грн" {{{ 'decimal' codec can't encode characters in position 4-6: invalid decimal Unicode string }}} Method '''to_python''' catch only 'DecimalException' but not 'UnicodeEncodeError'. {{{ C:\Python\lib\site-packages\django\forms\fields.py in to_python """ if value in validators.EMPTY_VALUES: return None if self.localize: value = formats.sanitize_separators(value) value = smart_text(value).strip() try: value = Decimal(value) ... except DecimalException: raise ValidationError(self.error_messages['invalid']) return value def validate(self, value): super(DecimalField, self).validate(value) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/20251> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.