On Jan 24, 4:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jan 24, 1:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > On Jan 23, 5:41 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > > > > Would you be willing to test this out in your local copy of Django, > > > and report back?Yes, I will try this and report back. If I create a model > > > instance from > > a form like so: model = Model(**form.clean_data), I also need to > > .encode('utf-8') all the entries (model.field.encode('utf-8')) .. is > > this somehow related? > > I wrap every instance of gettext() with smart_unicode() in fields.py > (latest svn) as you said, but I still get the error -- on every form > that I submit with invalid data.
I just started a new project and the same problem arises: I create a fresh app, create a simple view that hanles POST data through newforms .. it works fine as long as LANGUAGE_CODE is set to en-us, but fails with the following error if I change it to sv-se: UnicodeEncodeError at /create/ 'ascii' codec can't encode character u'\xe4' in position 31: ordinal not in range(128) Request Method: POST Request URL: http://127.0.0.1:8000/create/ Exception Type: UnicodeEncodeError Exception Value: 'ascii' codec can't encode character u'\xe4' in position 31: ordinal not in range(128) Exception Location: /System/Library/Frameworks/Python.framework/ Versions/2.3/lib/python2.3/site-packages/django/newforms/forms.py in _html_output, line 116 Template error In template /Users/gs/Sites/testar/templates/form.html, error at line 2 Caught an exception while rendering: 'ascii' codec can't encode character u'\xe4' in position 31: ordinal not in range(128) 1 <form method="post" action="/create/"> 2 {{ form }} 3 </form> Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/django/template/__init__.py" in render_node 712. result = node.render(context) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/django/template/__init__.py" in render 767. return self.encode_output(output) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/django/template/__init__.py" in encode_output 749. return unicode(output).encode(settings.DEFAULT_CHARSET) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/django/newforms/forms.py" in __unicode__ 60. return self.as_table() File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/django/newforms/forms.py" in as_table 131. return self._html_output(u'<tr><th>%(label)s</th><td>%(errors)s% (field)s%(help_text)s</td></tr>', u'<tr><td colspan="2">%s</td></tr>', '</td></tr>', u'<br />%s', False) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/django/newforms/forms.py" in _html_output 116. output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text}) UnicodeEncodeError at /create/ 'ascii' codec can't encode character u'\xe4' in position 31: ordinal not in range(128) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---