Ok, I could not reproduce the problem intentionally, but it is back: I have a form that is incomplete. Error messages are displayed correctly. However, if I set LANGUAGE_CODE to 'sv-se' I get the following (no other code is altered):
UnicodeEncodeError at /gs/admin/pages/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/gs/admin/pages/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 101 Template error In template /Users/gs/Sites/pages/../pages/admin/templates/admin/pages/page-form.html, error at line 15 Caught an exception while rendering: 'ascii' codec can't encode character u'\xe4' in position 31: ordinal not in range(128) 5 <div id="pages"> 6 7 <p><a href="/{{ user }}/admin/pages/">« Gå tillbaka till överblick</a></p> 8 9 10 {% if page_id %} 11 <form method="POST" action="/{{ user }}/admin/pages/edit/{{ page_id }}/"> 12 {% else %} 13 <form method="POST" action="/{{ user }}/admin/pages/create/"> 14 {% endif %} 15 {{ form.as_p }} 16 <input type="submit" value="{% trans "Create" %}"> 17 </form> 18 </div> 19 {% endblock %} On Dec 30 2006, 10:31 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Dec 30, 8:38 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > > > You shouldn't have to hack around the library like that; it's intended > > to handle encoding issues for you. Could you create a ticket (or just > > respond here) with the offending data, the offending code and the full > > traceback? That way, we'll fix the library so you don't have to hack > > around it.Odd. I created a new project and an application, threw in a > > couple of > models and forms, changed LANGUAGE_CODE .. and it simply worked. I've > had loads of trouble with the two previous test-applications that I > built. I did, however, svn the framework since then, but I cannot > confirm if anything has changed that could affect my problems. I will > post again if I manage to reproduce the problem. > > Now all I do to get some localization going is encode all varchar/text > fields of models before saving (model.field = > model.field.encode('utf-8')), otherwise MySQL truncates the data after > the first non-ascii character (utf-8 database). > > Is there a cleaner solution to that too perhaps? :) > > --- > Gustaf --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---