开发者

Special characters are displayed on the page from database, how to solve it?

I have开发者_StackOverflow社区 page in which data is being fetched and displayed. But few of the characters are displayed as special characters

Likewise: Â , inverted question etc...

I am using mysql db and PHP


sounds like the charset problem thats been discussed on SO and all over the internet a million times (on SO theres a search function that you should use before asking a question). simply use the same charset everywhere (and, if you have to choose, use utf-8). this is a very good and short instruction what you'll have to do. basically:

  • deliver your site as utf-8 (by setting the correct header)
  • use uft-8 for database-connection (mysql_set_charset('utf8'); or SET NAMES UTF8;) (this is what most people forget)
  • use uft-8 as collation for varchar/text-fields in your DB
  • set accept-charset to utf-8 on your forms


To help you we will need more details. This is probably a charset problem. Like if your database is in ISO 8859-1 but your webpage is in UTF-8.

Check the charset of your database tables and the charset of your pages.

I will update my answer with more usefull tips when you provide more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜