I am working on a project where a user enters his info and I save it into database, a user posted a string in the form " I still am… ". But the string stored in database as " I still am… ".
Now I am wondering why this happened, by looking at the string it is cleared that the suffix used after am is a kind of special characters and is converted into …
.
You have to set the UTF-8 as the connection to a database too. It is set to Windows 1252 by default. (This encoding is often incorrectly labelled ISO 8859-1.)
The bytes E2 80 A6
are rendered as …
in UTF-8 and as …
in Windows 1252. The PHP is most of the time unaware of an encoding and pass raw bytes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.