INADA Naoki added the comment: UTF-8 and Latin1 are typical encoding for MySQL query. When inserting BLOB:
# Decode binary data x = data.decode('ascii', 'surrogateescape') # %-format query psql = sql % (escape(x),) # sql is unicode # Encode sql to connection encoding (latin1 or utf8) query_bytes = psql.encode('utf-8', 'surrogateescape') So decoder speedup is required only for ascii, but encoder speedup is required for utf-8 and latin1. I'll consider other ways including creating speedup module and register it on PyPI. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24870> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com