Hi, I am building a fairly large website but I have come a cross one very odd error. We build a simple email record model that has a custom def save() function which when called creates a new Record and fires of the email(s). Now this all works fine till I get a non English PC using this (the error below is from our very basic contact form!)
Exception Type: UnicodeEncodeError at /contact-opal-students/ Exception Value: 'ascii' codec can't encode character u'\xb4' in position 88: ordinal not in range(128) For some reason when we try to put the email context into the db field the errors out as it trys to ASCII a unicode field. I already had a lengthy chat with people in IRC who tried to help but we couldn't find what was wrong. This happens on our live server (debian, apache-mod python 2.4, mysql) and on our development machines (windows, python 2.5, django devserver, mysql 5) To reproduce it I have to change a virtual machine to some foreign language settings and enter some "odd" chars like ' ` ... I can "fix" the issue by switching to Postgrsql which seems to not have this problem (tried it and it works fine, but I would need to change some code in other places, so I would prefer to find out what this error is about)? Google has only a few hits on this with out much use. Thanks --- (the whole error is on dpaste.com as well http://dpaste.com/48646/ with code) Traceback: Environment: Traceback: File "c:\python25\lib\site-packages\django\core\handlers\base.py" in get_response 82. response = callback(request, *callback_args, **callback_kwargs) File "C:\PROJECTS\OpalStudents\cms\views.py" in ContactUs 60. an_email.save(object) File "C:\PROJECTS\OpalStudents\EmailSystem\models.py" in save 101. super(EmailRecord, self).save() File "c:\python25\lib\site-packages\django\db\models\base.py" in save 272. self.save_base() File "c:\python25\lib\site-packages\django\db\models\base.py" in save_base 329. result = manager._insert(values, return_id=update_pk) File "c:\python25\lib\site-packages\django\db\models\manager.py" in _insert 127. return insert_query(self.model, values, **kwargs) File "c:\python25\lib\site-packages\django\db\models\query.py" in insert_query 729. return query.execute_sql(return_id) File "c:\python25\lib\site-packages\django\db\models\sql \subqueries.py" in execute_sql 300. cursor = super(InsertQuery, self).execute_sql(None) File "c:\python25\lib\site-packages\django\db\models\sql\query.py" in execute_sql 1466. cursor.execute(sql, params) File "c:\python25\lib\site-packages\django\db\backends\util.py" in execute 18. return self.cursor.execute(sql, params) File "c:\python25\lib\site-packages\MySQLdb\cursors.py" in execute 151. query = query % db.literal(args) File "c:\python25\lib\site-packages\MySQLdb\connections.py" in literal 247. return self.escape(o, self.encoders) File "c:\python25\lib\site-packages\MySQLdb\connections.py" in string_literal 180. return db.string_literal(obj) Exception Type: UnicodeEncodeError at /contact-opal-students/ Exception Value: 'ascii' codec can't encode character u'\xb4' in position 88: 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 -~----------~----~----~----~------~----~------~--~---