Hello. There are 2 parts of the project. Part 1 is written in python, it should translate the string to hex / blob / binary (I don’t know which is better for storing hex). And writes it to mysql. Function by which str -> hex
def strbin(s): return ''.join(format(ord(i),'0>8b') for i in s)
The field in the table so far has the type LONGBLOB (can you tell me which is better) And so the next part on php.
$mysqli->query("SELECT CONVERT(response USING utf8) FROM tablename WHERE id = 1 INTO OUTFILE '/tmp/test.txt'");
But the trouble is, the output is hex or just some strange symbols. I still do not understand where I was wrong, please tell me.
str
type (bytes
on Python 3)) to convert to put in a database (remarkably binary data (blob) are able to store databases). If the input text (in Python, use theunicode
type (str
on Python 3)), then again you do not need to convert to the "01" string - mysql can store (BMP) Unicode characters directly. - jfs