Reputation: 1087
I have some records in mysql database which contains some weird characters. When I checked those records in mysql then it shows a (square) for such characters. Also when I use a PHP command line script to show such records then such characters (square) are not visible on command line. It simply shows blank for such characters.
I think these characters are some special characters for apostrophes and quotes. We have already used the mysql_real_escape()
function to escape special characters.
It shows squares in following examples:
it[] good idea....
That[] fine....
We don[] t have that...
Can you please let me know how to solve this issue? Does anyone else face such an issue?
Upvotes: 0
Views: 232
Reputation: 5620
I had a lot of problems with that too. It all depends on the "magic_quotes_gpc" property that is configured in php. On some web host it is set to "on" and on some others it is not.
Try quoted_printable_decode($value)
in the first case, and str_replace("'", "''", $value)
I'm pretty sure that there's a better function that deals will both cases, but for the moment that's the only approach that worked for me lol.
Upvotes: 1