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,201
  • 5
  • 43
  • 61
Jacques
  • 1,609
  • 2
  • 13
  • 22

3 Answers3

0

Try to replace

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

with

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

Try this:

$sql = str_replace( chr(146), "\'", $sql);
Shubanker
  • 2,512
  • 17
  • 23
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
  • 2,731
  • 21
  • 28