¬ characters appearing in database values
I have a strange issue where I type text into a textarea, it gets UPDATE to a MySQL database. mb_detect_encoding() on the $_POST variable in PHP returns "ASCII".
Then, when the text is read back from the database, added o the textarea field, I just update it to the database again, but this time all the spaces have a ¬ characters in front of them. mb_detect_encoding() on the $_POST variable gives "UTF-8". Example data in the database:
The HTML headers have the utf8 meta tag:
Due¬ to¬ inclement¬ weather,¬ we¬ will¬ be¬ closed¬ on¬ 1/4.
OS platform (windows vs *nix), PHP, MySQL versions don't seem to matter--the issue seems to happen everywhere.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
The database is using the default collation of latin1_swedish_ci. Changing the collation to utf8_general_ci doesn't make a difference.
I've been banging my head against the wall for hours on this issue--I've never encountered it before. The reason this matters is that I need to count the number of characters and limit the string to x number of characters. When I try to save the string to the database for a second time, there are extra characters counted in the string, but when I do a var_dump() of the string, there is nothing extra there. I don't get it. :confused: