Hi,

I've got a problem with putting non unicode signs into a mysql table.

I get an UnicodeEncodeError when an user puts the Euro Sign (€) in a
newform Textfield. The Exception raises when when Django want to write
into the MySQL Database.

Do I have to encode (or decode) the string before I put it into the
database or do i have to change the DEFAULT_CHARSET ?

This is the Traceback:

UnicodeEncodeError at /mail/schreiben/2/
'latin-1' codec can't encode character u'\u20ac' in position 0: ordinal
not in range(256)
Request Method:                 POST
Request URL:                    http://127.0.0.1:8000/mail/schreiben/2/
Exception Type:                 UnicodeEncodeError
Exception Value:                'latin-1' codec can't encode character 
u'\u20ac' in
position 0: ordinal not in range(256)
Exception Location:
                /usr/lib/python2.4/site-packages/MySQLdb/connections.py in
unicode_literal, line 179

/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py
in get_response
/home/christian/sail/saildj/../saildj/mailing/views.py in writemail
/home/christian/sail/saildj/../saildj/mailing/models.py in senden
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/base.py
in save
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py
in execute
/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/mysql/base.py
in execute
/usr/lib/python2.4/site-packages/MySQLdb/cursors.py in execute
/usr/lib/python2.4/site-packages/MySQLdb/connections.py in literal
/usr/lib/python2.4/site-packages/MySQLdb/connections.py in
unicode_literal

The POST Data from the user was the Euro Sign:

POST:

Variable        Value
betreff         'testmail'
thread_id       ''
text            '\xe2\x82\xac'

I hope you can help me...

Thanks,

Christian.


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