We help IT Professionals succeed at work.

UTF-8 characters from MySql database not displaying on web page

Recipe title on this page has a ’ character that is not displaying properly:

It is coming from a database. When I am looking at the title in phpMyAdmin, I see:
Berks Fiesta Hot Dog Hors D’oeuvres

But on the web page, I see:
Berks Fiesta Hot Dog Hors D�oeuvres

My doctype is:
<!DOCTYPE html>

I also have this meta tag:
<meta charset="utf-8">

Shouldn't that be enough to make the UTF-8 character display properly? I'm not sure what I'm doing wrong.

Thank you!
Watch Question

Fixer of Problems
Most Valuable Expert 2014
Trouble is that it's not a UTF-8 character but a Latin1 character.  You would have to make it a different 'code point' for it to be that same character in UTF-8.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Or you could use "&#8242; or &prime;" character entities.  http://www.alanwood.net/demos/ent4_frame.html
Brad BansnerWeb Developer


Thanks for the advice. In the meantime, I converted them from fancy to plain quotes, to fix the problem.

It must be true that you can use those characters without encoding them with & HTML codes. I know I have done it in the past. And MySql displays it properly on my screen.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Sorry, it just does not work that way.  Character sets and Unicode / UTF-8 can be very confusing and irritating.  Almost all character sets have the ASCII character set, the first 127 codes, in common.  After that, they vary greatly.  Latin1 is a single byte code set which restricts it to 256 characters.  Unicode / UTF-8 is a multi-byte character set with over 1 million possible characters.

The default character set for PHP and phpMyAdmin has been Latin1.  The new versions may be switching to UTF-8.  The default character set in Windows is Windows-1252 which is essentially Latin1.

Here http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html is an article by Ray Paseur on the subject.