I am experiencing some issues with curly quotes and apostrophes when pasting from a word document into tincymce hmtl editor, for some reason it converts these characters into Â, ’ etc.
Things I have checked:
Firstly I have ensured all the html pages all have the correct content type tag declared:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Additionally, when var_dumping the output into the browser the characters display correctly which lead me into thinking that perhaps the database was not storing in UTF-8. I have checked this and when manually inserting the characters and storing them via phpMyAdmin these store perfectly fine.
So the problem seems to lie somewhere just before storing the data in the database, so to check this I enclosed the data in:
utf8_encode(string)
Right before saving into the database and this resolves the problem. Now I don't feel this is a permanent solution but I cannot seem to figure out why this is happening.
I have tried adjusting tinyMCE encoding to 'raw':
tinymce.init({
entity_encoding : "raw"
});
but this has not resolved the issue, can anyone shed some light into what might be happening here?
Instead of
’
, you were expecting’
, correct? That's Mojibake, which usually implies that you failed to declare the table column to beCHARACTER SET utf8
.Do not use
utf8_encode()
.