1

The answers to the suggested duplicate go a bit over my head. The text with the smart quotes, etc is old and extremely difficult to get changed. T modify the PHP/MySQL setup I am using is also hairy for me. If I use charset=iso-8859-1 everything echo's fine. Any problem with that? English only with a few html img links to image files.

"I have a MySQL database with legacy text in blob columns (lots of smart quotes, long dash, etc.) I am developing a new website and when PHP pulls out the text the browser echo's a question mark inside a black diamond for the smart quotes, etc.

I currently have meta charset="utf-8" in the HTML source."

Rob
  • 19
  • 3
  • 1
    is the mysql connection also configured to connect and use utf8, as PHP MySQL clients still defaults to connecting in latin1? See the duplicate below.. – Raymond Nijland Apr 04 '19 at 21:19
  • Not sure but it is something I am not going to get to change. How about just using the iso-8859-1 character set. This source data is American english text generated by MS-Word and MacOS Pages and was loaded into a MySQL 5.6 blob columns a long time ago. What is the downside to these two or three webpages using that charset? – Rob Apr 05 '19 at 22:05

1 Answers1

1

Convert to the HTML entities:

$text = 'text — and “ text ”';

echo htmlentities($text);

Yields:

text — and “ text ”

Which will display the proper characters in the browser.

AbraCadaver
  • 78,200
  • 7
  • 66
  • 87
  • Looks like a good idea and what I am looking for but it is not working. I don't know how to post my code here but the code looks exactly like what you suggest. – Rob Apr 05 '19 at 12:15