0

Hello,

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:

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

	include("core/scripts/db_connection.php");
	
	$query	= "SELECT `logdownloadid`, `stitle` FROM `downloadstats` WHERE `country` = 'CHINA'";
	$result	= mysql_query($query);
	

?>
<html>
	<head>
		 
		<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"/>
		
		<?php
			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>";
			}
		?>
		
	</head>
	<body>
	</body>
</html>

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

HELP!!!

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by smantscheff
1

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'");
or
mysql_set_charset( "utf-8" );

0

Thanks!!!!

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!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.