0

I copied and pasted one paragraph in mysql table. many other paragraphs from table display alright but this one paragraph has lot of black background question marks in place of Apostrophes or single &double quotes.i have utf-8 in meta tag. surprisingly str_replace is no working either.this quote mark ( ’ ) is causing a lot of trouble can't replace it with (') using str_replace. i'have tried $story=str_replace("’","'",$story); and $story=str_replace("\’","\'",$story); .i have been searching through solutions but none of them seems working.

Nav Sandhu
  • 73
  • 1
  • 1
  • 6

1 Answers1

0

utf-8 doesn't recognize the smart quote character. You will have to use the character code instead

$text = str_replace(chr(145), "'", $text);    // left single quote
$text = str_replace(chr(146), "'", $text);    // right single quote
$text = str_replace(chr(147), '"', $text);    // left double quote
$text = str_replace(chr(148), '"', $text);    // right double quote
Brian McCall
  • 1,831
  • 1
  • 18
  • 33