I keep getting these weird text characters when I display user submitted text. like in the following example below. Is there a way I can fox this using PHP, CSS or something so that the characters are displayed properly?
Here is the problem text.
Problems of �real fonts� on the web. The one line summary:
different browsers and different platforms do �hinting�
Here is my meta tag.
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
It’s an encoding problem. Make sure you send the correct encoding to the browser. If it’s UTF-8, you’ll do it like this:
Also, make sure that you store the content using the same encoding throughout the entire system. Set your database tables to
utf8. If you’re using MySQL, run theSET NAMES utf8query when connecting to make sure you’re running in UTF-8.These weird characters occur when you suddenly switch encoding.
Also, some functions in PHP take a
$charsetparameter (e.g.htmlentities()). Make sure you pass the correct charset to that one as well.To make sure that PHP handles your charset correctly in all cases, you can set the
default_charsettoutf-8(either inphp.inior usingini_set()).