Hello,

I have run into a character-encoding error while developing a custom
admin site with the newforms-admin branch.

Everything works fine with standard alphanumeric input, but as soon as
I enter a special character (an accented e or a pound sign, for
example) into a text field or textarea, I get the following error:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError at /admin/profile/profile/1/
'ascii' codec can't encode character u'\xe9' in position 5: ordinal
not in range(128)

Request Method: POST
Request URL:    http://127.0.0.1:8000/admin/profile/profile/1/
Exception Type: UnicodeEncodeError
Exception Value:        'ascii' codec can't encode character u'\xe9' in
position 5: ordinal not in range(128)
Exception Location:     /Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/site-packages/django/db/backends/util.py in execute,
line 17
Python Executable:      /Library/Frameworks/Python.framework/Versions/2.4/
Resources/Python.app/Contents/MacOS/Python
Python Version: 2.4.4
Traceback (innermost last)

Switch to copy-and-paste view

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/core/handlers/base.py in get_response
                response = callback(request, *callback_args,
**callback_kwargs) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/sites.py in root
            return self.model_page(request, *url.split('/', 2)) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/sites.py in model_page
        return admin_obj(request, rest_of_url) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/options.py in __call__
            return self.change_view(request, unquote(url)) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/options.py in change_view
                return self.save_change(request, model, form,
inline_formsets) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/contrib/admin/options.py in save_change
        new_object = form.save(commit=True) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/newforms/models.py in save
        return save_instance(self, instance, fields, fail_message,
commit) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/newforms/models.py in save_instance
        instance.save() ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/db/models/base.py in save
                        db_values + [pk_val]) ...

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/django/db/backends/util.py in execute
            return self.cursor.execute(sql, params) ...

--------------------------------------------------------------

In that particular case, the offending data was u'asdf \xe9' (It was
entered as asdf é). FYI, I am using Postgres.

Does anyone have a clue what is going on? I have found at least four
references to this problem in previous posts and tickets, but no solid
explanations or answers.

Any help would be greatly appreciated! I've already spent a half-day
trying to figure this out.

Thanks!!


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to