Skip to content

Commit

Permalink
Force UTF-8 for database access
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Aug 26, 2022
1 parent a233741 commit af5bac2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/saliweb/frontend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def _get_logged_in_user():

def _get_user_from_cookie(c):
dbh = get_db()
dbh.set_character_set('utf8')
cur = MySQLdb.cursors.DictCursor(dbh)
cur.execute('SELECT first_name,last_name,email,institution,modeller_key '
'FROM servers.users WHERE user_name=%s '
Expand Down
3 changes: 3 additions & 0 deletions test/pyfrontend/MySQLdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class _MockConnection(object):
def cursor(self):
return _MockCursor()

def set_character_set(self, cs):
pass

def commit(self):
pass

Expand Down

0 comments on commit af5bac2

Please sign in to comment.