FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » store backslash in mysql database
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: store backslash in mysql database [message #170686 is a reply to message #170683] Sun, 14 November 2010 22:41 Go to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Robert Hairgrove)

> Michael Fesser wrote:
>>
>> 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.
>
> But don't you think it is much easier just to store it in base64 or some
> hex format?

No, because it simply is not necessary. Do you also encode textual data
just in case it might contain troublesome characters? No. Instead you
ensure that the data you have will make it correct and 1:1 into the DB.
That's what functions like mysql_real_escape_string() and prepared
statements are for.

> Once it is converted, all the data is in 7-bit ASCII format,

And two times bigger or so.

> and character set issues can then be ignored WRT the MySQL DB. Why make
> life more difficult than it already is?

What can be more easy than plain data in, plain data out? You just have
to do it right with the correct functions. It's all there already.

Micha
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: website url as input how to create and save image on server in php?
Next Topic: Cannot write utf8 data into a utf8 column
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 14:45:03 GMT 2024

Total time taken to generate the page: 0.04451 seconds