Re: store backslash in mysql database [message #170668 is a reply to message #170665] |
Sun, 14 November 2010 17:11 |
Peter
Messages: 15 Registered: March 2003
Karma:
|
Junior Member |
|
|
In article <1g20e6900nhpj7k9ko2gvl223tl6jhmmgk(at)mfesser(dot)de>,
netizen(at)gmx(dot)de says...
> .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.
>
Well, I wouldn't exactly have called it a bug. It was a script that I
found on the internet and it's possible the original creator didn't have
it in mind to store the data in a mysql database. And as I didn't write
the script, who knows?
As to debugging the script, it uses some maths functions including ord
to convert the original data into the encrypted data. So, I'm not sure
how the function is supposed to know what the outcome of the encryption
is going to be before it knows what the input is?
So, all I could potentially do, as I see it, is include an extra:
if, char converted to backslash, then change to a different char.
However, how would I then know, when decrypting back that the different
char wasn't created as part of the original encryption or by my if
statement?
--
Pete Ives
Remove All_stRESS before sending me an email
|
|
|