Chinese chars from db rendered as "question marks"

Problem: Chinese characters from DB are not properly rendered in report
Description: Chinese characters from DB are not properly rendered in the report, and appear as "???"question marks. Attached a screenshot of the problemhttp://typesetting.altervista.org/sites/default/files/pictures/question_marks.png
My database (MyISAM) encoding is utf8_general_ci
and the information are correctly stored inside (e.g. I can correct view these chinese chars in the db using phpmyadmin)
How can I solve this issue?

Thank you in advance for any support.
Francesco

Thanks for the report! That’s a new issue as normally chinese characters work fine in Piwik.

Can you send me an example simple HTML page with a piwik code in it, that you have checked and used to reproduce the issue?

then once I can reproduce the issue we can fix it. Thanks!

Dear Matt, thank you for the reply.

I made some research around in google, and found that adding


//Set UTF to solve the question marks issue with Chinese chars
mysql_set_charset("utf8"); 

can solve this issue, so I made the following simple php file for a simple test:


//Set UTF to solve the question marks issue with Chinese chars
mysql_set_charset("utf8"); 

// Performing SQL query
$query = 'SELECT * FROM  piwik_log_action LIMIT 0 , 30';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
        echo "\t\t<td>$col_value</td>\n";
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>

and effectively it works, the question marks ??? turn back to the correct Chinese chars! Anyway I don’t know if I can, and eventually where I can add this line into which Piwik file.
What do you think? Is this the correct approach to solve this issue?

Attached is a simple html file with the Piwik tracking code inside.

Cheers and thank you again,
Francesco

Hi Francesco! Thank for the report and follow up. I created an issue: Add system check that errors when Mysql charset is not utf-8 · Issue #6439 · matomo-org/matomo · GitHub can we continue the discussion there?