Re: store backslash in mysql database [message #170683 is a reply to message #170665] |
Sun, 14 November 2010 22:25 |
Robert Hairgrove
Messages: 19 Registered: September 2010
Karma:
|
Junior Member |
|
|
Michael Fesser wrote:
> .oO(Robert Hairgrove)
>
>> I suggest you convert the data to something like base64 format or URI
>> encoding before storing it in the database. That way, you avoid this
>> issue and perhaps a few others as well (i.e. any unforeseen implicit
>> conversions of binary data). Besides, you can store the data as a normal
>> VARCHAR or TEXT field.
>
> I would rather suggest to find the real reason for the problem and fix
> it. It's a bug in some part of the code, not in MySQL.
>
> If MySQL would have a problem with such data, you won't be able to store
> BLOBs either. But a byte can be anything from 0x00..0xFF. Binary data is
> binary data - MySQL won't touch it, so the problem is somewhere in the
> scripts. Either the decryption fails or - even more likely - the data is
> already improperly sent to the DB by the encryption script.
>
> Micha
But don't you think it is much easier just to store it in base64 or some
hex format? Once it is converted, all the data is in 7-bit ASCII format,
and character set issues can then be ignored WRT the MySQL DB. Why make
life more difficult than it already is?
|
|
|