Comment 2 for bug 725616

Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

Remember verifying this, but did not update the bug.. thanks for the great report!

Smaller test case:

    cnx = mysql.connector.connect(database='test',charset='utf8')
    cur = cnx.cursor()
    cur.execute('DROP TABLE IF EXISTS t1')
    cur.execute('CREATE TABLE t1 (c1 BINARY(1), UNIQUE KEY (c1))')

    insert = "INSERT INTO t1 VALUES (%s)"
    data = (b'\x80')
    cur.execute(insert, (data,))
    cur.execute(insert, (data,))

    cur.close()
    cnx.close()

This is Python 3 specific, and we'll fix it like this in errors.raise_error()
  errmsg = buf.decode('utf-8','surrogateescape')

Maybe we can do something similar for Python v2, but