0

I have some strings being echoed from a MySQL DB and there are special HTML characters inside them and when it renders in Chrome I get the diamond question mark.

If I dump the array data in PHP I get:

"_value" => b"10-13”"

If I just echo the data I get "10-13question mark"

It appears it is a right double quote with the HTML code "”"

I have tried using preg_replace and it won't work. I have tried changing the meta charset and still nothing.

My goal is to just have it echo 10-13"

Is it a DB issue, HTML meta issue or just have PHP sanitize the quotes and change it?

Chad Priddle
  • 650
  • 2
  • 15
  • 32
  • `”` is not a double quote, it is an MS smart quote. Likely your char set is ascii which that character outside of. You need to identify where the char is being lost (writing to db, db retrieval, PHP to HTML doc) – user3783243 Sep 29 '20 at 18:43
  • Those curved quotes are likely from the Latin1-extension charset, which is owned by Microsoft. UTF-8 cannot support them. – HoldOffHunger Sep 29 '20 at 18:44
  • HTML entities would be the correct approach. – mario Sep 29 '20 at 18:44
  • Else: [UTF-8 all the way through](//stackoverflow.com/q/279170) – mario Sep 29 '20 at 18:45
  • The DB table and row is set to utf8mb4_unicode_ci, the data is being put there by WordPress, so I can't really change it when its being added to the DB – Chad Priddle Sep 29 '20 at 19:22
  • This is a problem with encoding, not replacing double quotes. I don't know why question was closed with incorrect duplicate. – Jsowa Sep 29 '20 at 20:19

0 Answers0