0

The character comes from an XML feed.

Here is an excerpt:

Kock’s parole

As you see, it is not a normal '

We tried

$sql = str_replace("’", "\'", $sql);

But that does nothing.

Any ideas?

Albzi
  • 15,431
  • 6
  • 46
  • 63
Jacques
  • 1,649
  • 2
  • 14
  • 23

3 Answers3

0

Try to replace

$sql = str_replace("’", "\'", $sql);

with

$sql = str_replace("’", "'", $sql);
Branimir Đurek
  • 632
  • 5
  • 13
0

Try this:

$sql = str_replace( chr(146), "\'", $sql);
Shub
  • 2,686
  • 17
  • 26
0

I think if this is an sql statement, you will have to do something like this:

$sql = str_replace("’", "\\\'", $sql);

So for example if you sql statement is something like this:

$name = "Kock’s parole";
$name = str_replace("’", "\\\'", $name);
$sql = "INSERT INTO users (`name`) VALUES ('$name')";

then this will work fine for you.

John Skoumbourdis
  • 3,041
  • 28
  • 34