Foreign Launguge from MySQL showing up as ?'s in my PHP file
I have a page that is in a foreign language. Whats pull from the MySQL db displays as ?'s where the hard coded words are showing properly. In the DB the word are displayed properly too.
开发者_Python百科I added <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
to the head tag.
Any ideas?
Your databnase should be in UTF-8 (You can check it in PHPMyAdmin)
Your connection should be in UTF-8 (before any query: SET NAMES utf-8
or default somewhere in settings)
Your meta-tag should be UTF-8 (Done)
try to run
@mysql_query("SET NAMES 'utf8'");
before any DB requests
I think you should use utf8. You have to write your PHP files in utf8 (use an editor that support it), then on your website use this line on the header:
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
So you notice the user browser that you are using utf-8 This should allow words to be displayed correctly
精彩评论