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
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') execute( 'DROP TABLE IF EXISTS t1') execute( 'CREATE TABLE t1 (c1 BINARY(1), UNIQUE KEY (c1))')
cur = cnx.cursor()
cur.
cur.
insert = "INSERT INTO t1 VALUES (%s)" execute( insert, (data,)) execute( insert, (data,))
data = (b'\x80')
cur.
cur.
cur.close()
cnx.close()
This is Python 3 specific, and we'll fix it like this in errors. raise_error( ) 'utf-8' ,'surrogateesca pe')
errmsg = buf.decode(
Maybe we can do something similar for Python v2, but