Answer the question
In order to leave comments, you need to log in
How to properly handle NUL character?
Data is stored remotely in ASCII.
Example data (in the second column in the 16th system for understanding):
1) ]�1�*...� 5D 83 31 91 2A 12 00 D4
2) ]�1�*.� 5D 83 31 91 2A 1C 00 B9
3) ]�1�*‑�� 5D 83 31 91 2A 1E FF F0
4) ]�1�*.� 5D 83 31 91 2A 1F 0E F9
I get this data, convert it to 16ths using the bin2hex() function and save in the table. In another place, I pull it out of the table, convert it back with the hex2bin () function and send it for processing.
Items 1 and 2 contain '00' (NUL character), which is not displayed in any way in PHP, although it goes into the var_dump() character counter. As a result, records that contain this character cannot be processed correctly. As far as I could understand, this is due to the fact that the NUL character is not taken into account / lost / removed / cannot be processed by php (the <0x00> is not even displayed in the editor).
Tried to somehow catch this symbol to try to make a replacement, but could not find a way to catch "nothing".
Completely stumped. I would be glad to solve this problem or ideas in which direction to dig. Deleted data cannot be changed.
Answer the question
In order to leave comments, you need to log in
Data can be stored in a BLOB field https://dev.mysql.com/doc/refman/8.0/en/blob.html
As a result, records that contain this character cannot be processed correctly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question