In python, I compressed a string using zlib, and then inserted it into a mysql column that is of type blob, using the utf-8 encoding. The string comes back as utf-8, but it's not clear how to get it back into a format where I can decompress it. Here is some pseduo-output:
valueInserted = zlib.compress('a') = 'x\x9cK\x04\x00\x00b\x00b'
valueFromSqlColumn = u'x\x9cK\x04\x00\x00b\x00b'
zlib.decompress(valueFromSqlColumn) UnicodeEncodeError: 'ascii' codec can't encode character u'\x9c' in position 1: ordinal not in range(128)
if i do this, it inserts some extra characters:
valueFromSqlColumn.encode('utf-8') = 'x\xc2\x9cK\x04\x00\x00b\x00b'
Any suggestions?