![](https://secure.gravatar.com/avatar/e8182135be0245df69df7ddf7f70856a.jpg?s=120&d=mm&r=g)
It should according to the docs I found, provided I've applied them correctly, fix the non-ASCII character encoding problems (I've relied on the assertions about list members to cover that angle, and just checked encoding on the 'user supplied' parameters to various function calls).
Hi Kev,
I finally got the time to look at your character encoding problem and patch, and I was not able to make it work. I still getting the dreaded UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in range(128)
On my version of MysqlMemberships.py there is a centralized function which does the escaping and is used on every sql request:
def escape(self, value):
# transforms accents into html entities (é)
# TODO: find out which language is current (here: uses iso-8859-1)
value = Utils.uncanonstr(value)
# addslashes before " and '
return MySQLdb.escape_string(value)
I tried to add your unicode logic at this point, but to no avail. And BTW I also need the thing to be functional both with utf8 and iso-8859-1.
For people who'd like to join in the conversation, the logic I'm refferring to is the following: # safe unicode strings encoded for mysql # http://effbot.org/pyfaq/what-does-unicodeerror-ascii-decoding-encoding-error... try: unicode(value, "ascii") except UnicodeError: value = unicode(value, "utf-8") else: # value was valid ASCII data pass
-- Fil