diff options
author | Rob Austein <sra@hactrn.net> | 2015-11-23 22:31:49 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2015-11-23 22:31:49 +0000 |
commit | 1f55ae0e36e228ee796358158a0882383a932442 (patch) | |
tree | a000177c13448bddb8abaa5813bb6b4832a8ef9e /rpki | |
parent | af9c7f0f35e2462a5f29526c16e38f9b222e154f (diff) |
Kludge that works around characterset madness with MySQL 5.6 breaks
MySQL 5.5, so try the kludge, whine if it fails, then blunder ahead.
Fixes #781.
svn path=/trunk/; revision=6190
Diffstat (limited to 'rpki')
-rw-r--r-- | rpki/sql.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rpki/sql.py b/rpki/sql.py index d75b45b3..96c8d086 100644 --- a/rpki/sql.py +++ b/rpki/sql.py @@ -81,8 +81,15 @@ class session(object): self.db.autocommit(True) self.timestamp = rpki.sundial.now() - # Try this as a workaround for MySQL 5.6 UTF8 characterset braindamage - self.execute("charset = latin1") + # Try this as a workaround for MySQL 5.6 UTF8 characterset + # braindamage, in which MySQL starts rejecting ASN.1 DER because + # it's not valid UTF-8. Twits. + # + # Except that it breaks MySQL 5.5, so wrap it and ignore errors. Twits ** 2. + try: + self.execute("charset = latin1") + except: + logger.info("Whacking charset to Latin1 to save MySQL 5.6 from its own confusion failed, blundering onwards") def close(self): if self.cur: |