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 2, 2022
1 parent a88f2d2 commit ad98ea2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/saliweb/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def _connect(self, config):
db=config.database['db'],
unix_socket=config.database['socket'],
passwd=config.database['passwd'])
self.conn.set_character_set('utf8')
c = self.conn.cursor()
# Make sure that our SELECTs see jobs added by the frontend
c.execute("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED")
Expand Down
3 changes: 3 additions & 0 deletions test/backend/MySQLdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def __init__(self, *args, **keys):
def cursor(self):
return DummyCursor(self.sql)

def set_character_set(self, charset):
pass


def connect(*args, **keys):
return DummyConnection(*args, **keys)

0 comments on commit ad98ea2

Please sign in to comment.