Message248820
> Why are bytes being escaped in a binary blob? The reason to use surrogateescape is when you have data that is mostly text, should be processed as text, but can have occasional binary data. That wouldn't seem to apply to a database binary blob.
Since SQL may contain binary data.
data = bytes(range(256))
cursor.execute(u"INSERT INTO t (blob_col) values (%(data)s)", {"data": data})
DB driver should escape properly for SQL syntax, then decode with surrogateescape for % operator.
bytes in Python 3.5 supports % operator so I can use it instead of unicode %.
But I'll continue to support Python 3.4 for some years. |
|
Date |
User |
Action |
Args |
2015-08-19 08:12:26 | methane | set | recipients:
+ methane, vstinner, ezio.melotti, r.david.murray, serhiy.storchaka |
2015-08-19 08:12:26 | methane | set | messageid: <1439971946.13.0.865557814401.issue24870@psf.upfronthosting.co.za> |
2015-08-19 08:12:26 | methane | link | issue24870 messages |
2015-08-19 08:12:25 | methane | create | |
|