I am dealing with a LAMP web server. I have forms that users use to submit text that is stored in a text box in mysql. Often this text is copied and pasted from Microsoft Office products, so I get a lot of smart quotes and emdash. These characters display correctly if I retrieve them from the database and display them on a web page, but where I encounter a problem, you send the text via email using the phpmailer class. I get stuff that looks like this: "(where should it be emdash).
One thing that may be important: if I pulled out the console in mysql and select a field that has emdash or a smart quote, it will not display correctly on my console: - as above if my php page (using PDO) selects field and displays it, it will be displayed correctly in the browser (in this case emdash).
I'm not sure if there is a way to select the character set in phpmailer (maybe this is a simple setup somewhere?) Or if there is a better way to solve this problem. I think it should be clear to me that “finding and replacing smart quotes and emdash with their usual equivalents” is NOT the answer I'm looking for (hopefully this is not the only solution).
I found this information:
My php webpage: utf-8
mysql client encoding: latin1
mysql server encoding: latin1
phpmailer character set: iso-8859-1
source
share