I've tried finding an answer to this, and I have the sense it has to do with encoding, but no success after many attempts made me think to ask here. Sorry if it's a duplicate.
I have a textarea input field being stored in a MySQL text column. When the text is entered directly into the textarea, it stores and displays fine. When it's typed into Word and then copy-and-pasted (something which my users insist on doing), it turns apostrophes and double-quotes into this:
' is displayed as ’
" is displayed as “
" is displayed as â€
However, I'm sure it's an encoding problem on the way out, because if I issue my select statements from command line, it displays fine. It's only if I look at the data via web (phpMyAdmin or via my actual application) that it garbles.
I tried this:
$output = str_replace("’","'",$input);
and
$output = str_replace("\â\€\™","\'",$input);
etc. But no effect. I downloaded Encoding::toUTF8 (mentioned in Detect encoding and make everything UTF-8), and it manages to replace the problematic strings, but indiscriminantly into question marks, instead of the originals.
I kind of feel like I'm poking around in the dark, and would appreciate any pointers!