I have a problem with recent versions of Django and MySQLdb. Django is now using a SafeUnicode class derived from unicode to represent Unicode strings in some cases (it's used as a part of a larger system to automatically escape strings as they are rendered into HTML to prevent people from hacking your site by inserting script tags).
Now the problem is that as far as I can tell, MySQLdb doesn't detect these strings as Unicode strings. Instead it converts them to ordinary strings which fails with Unicode strings with non-ASCII characters. The relevant Django bug is here:
Do you think it would be possible to make the Unicode detection a bit smarter so it can catch classes derived from unicode? This would really help, I spent quite some time last Friday debugging it. :-/
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I have a problem with recent versions of Django and MySQLdb. Django is now using a SafeUnicode class derived from unicode to represent Unicode strings in some cases (it's used as a part of a larger system to automatically escape strings as they are rendered into HTML to prevent people from hacking your site by inserting script tags).
You can see the definition of the class here:
http://code.djangoproject.com/browser/django/trunk/django/utils/safestring.py
Now the problem is that as far as I can tell, MySQLdb doesn't detect these strings as Unicode strings. Instead it converts them to ordinary strings which fails with Unicode strings with non-ASCII characters. The relevant Django bug is here:
http://code.djangoproject.com/ticket/6052
Do you think it would be possible to make the Unicode detection a bit smarter so it can catch classes derived from unicode? This would really help, I spent quite some time last Friday debugging it. :-/