I have strange characters appearing in my mysql data wherever a ’ (acute accent) appears. Mysql converts it to ’ (a bunch of chars)
First off, I collect some data from a text field. I pass the information through a couple of functions...
1) trim
2) regexp to replace multiple spaces with a single space
3) strip_tags
Next, I store the string into my database. I don't have magic_quotes on, so I do make a call to addslashes before the query is executed.
Now, when I pull the information back from the db and display it on the screen, it looks fine. Before displaying to the screen, I do run the string through htmlspecialchars. I tried using htmlentities but that made the accents look all garbaled.
Now, if I export my sql data (with phpmyadmin for instance) anywhere those accents are, I get the strange characters.
These characters are coming from clients who cut and paste information from word. They are apostrophes, but for some reason become these slanted apostrophes. Now, would it be okay if I run a regular expression to convert all accents to regular apostrophes? or am I doing this all wrong?
Thanks in advance.
First off, I collect some data from a text field. I pass the information through a couple of functions...
1) trim
2) regexp to replace multiple spaces with a single space
3) strip_tags
Next, I store the string into my database. I don't have magic_quotes on, so I do make a call to addslashes before the query is executed.
Now, when I pull the information back from the db and display it on the screen, it looks fine. Before displaying to the screen, I do run the string through htmlspecialchars. I tried using htmlentities but that made the accents look all garbaled.
Now, if I export my sql data (with phpmyadmin for instance) anywhere those accents are, I get the strange characters.
These characters are coming from clients who cut and paste information from word. They are apostrophes, but for some reason become these slanted apostrophes. Now, would it be okay if I run a regular expression to convert all accents to regular apostrophes? or am I doing this all wrong?
Thanks in advance.