I have a problem regarding special characters that are appearing messed up on the front-end .
mainly the get converted to question marks, or something like �?)
Example – Frédèric becomes Fr�d�ric.
some facts that made me puzzled:
-
This WP install is on LOCAL machine, and shares the server with at
least 40 other installs – none of which have this problem. -
This WP install shares also the same DB as the others .
-
My wp-config file has the collate and charset defined.
-
The DB seems fine , because when I am viewing the post in the EDITOR (back end) – all is correct , the problem is only on the FRONT end .
- The DB seems fine (2) , opening the post in phpMyAdmin and checking the direct value – all characters are fine .
-
This problem is NOT a browser/os encoding , it was checked in 4
different machines, 3 OS, and 9 browsers..
I have tried all the solutions which I know from past experience, which include :
- checking the wp-config (it is ok, utf-8 defined, collate ok)
- Checking the DB – all UTF-8
- checking my header
(<?php bloginfo('charset'); ?>
) – that renders
correctly as utf-8 with valid markup. - Open all theme files in my editor, convert encoding to UTF-8 without
bom and save.
Did i missed something ? Any Ideas ??
Edit:
Do you have
<meta charset="utf-8" />
in your<head>
tag? A user here fixed a similar problem with character encoding by adding this.There are actually many Google results that come up searching for
utf-8 character encoding in wordpress
.Also, does pasting the text into the HTML view of the editor and saving it make any difference?
Below is not such a good idea as @toscho explained in comments.
I am not sure if this is the best method to fix the problem but this worked for one of my clients’ websites.
Find these two lines in your
wp-config.php
file:And comment them out like so:
Are you using htmlentities() to escape your output by any chance? If so you need to define ‘UTF-8’ as the third parameter.