I'm getting product descriptions from Amazon web service and storing them in MySQL. I've noticed that, for some characters, what is stored in the database is not the same as what is displayed on my webpage. For example, 开发者_JAVA技巧the hyphen -
is showing as —
. Any idea what is wrong?
Looks like you're storing UTF and reading as something else like latin-1. (A character in UTF-8 can be encoded in more than one byte.)
Make sure that your webserver is using the right char encoding too. I had problems in the past with æøå (on danish websites) and just setting a charset in the html isn't enough if the server isn't set to use the right charset.
I think you should try adding the following code in your html <head>
section:
<meta charset="utf-8" />
And reading a bit about UTF-8 is worth too.
精彩评论