I need some help.

I have a MySql DB, and some fields have Japanese values.

DB collate is set to: utf8_general_ci

When I check for a specific register with PhpMyAdmin, values with japanese characters display ok, but when I try to get the same register to show it using php I got "???" characters. I have tried everything and still without solving this. here is my code:

	header("Content-type: text/html; charset=utf-8"); 

	$query	= "SELECT `logdownloadid`, `stitle` FROM `downloadstats` WHERE `country` = 'CHINA'";
	$result	= mysql_query($query);

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Radio and Television Service Statistics </title>

		<link rel="stylesheet" href="core/css/default2.css" 	type="text/css" media="screen"/>
			while($row = mysql_fetch_array($result))
                                echo $row[0]." : ".$row[1]."<br>";
				echo $row[0]." : ".utf8_encode($row[1])."<br>";
				echo $row[0]." : ".htmlentities($row[1], ENT_QUOTES, 'UTF-8')."<br>";

The JAPANESE characters doesn't display well using utf8_encode nor htmlentities.


Recommended Answers

All 3 Replies

Set the connection character set to utf-8, too.
mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
mysql_set_charset( "utf-8" );


I have guessed that I was missing that part, but I didn't knew how to set it up.

Now, it is working properly.

Thank you so much!

Please mark this thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.