MYSQL and HTML Japanese text displaying as question

Hi, I’m developing a beginner PHP & MySQL website, and as many people before me have to have the problem where the text is displaying as question marks.

The only problem is that I do have an meta tag, and I have checked that my database is also in utf-8 but it still doesn’t seem to work.

is utf8_unicode_ci the right coalition for varchar Japanese text? it seems to show up just fine in my database. The results for other columns in my database also show up just fine.

My config file


ini_set('display errors', 'On'); // change to 'Off when live

ini_set('default_charset', 'utf8_unicode_ci' );

define ("DB_NAME","epiz_25213442_00_l2_games");

 define ("DB_USERNAME","epiz_25213442");


define ("DB_HOST","");

$config["character-set-client-handshake"] = "FALSE";

$config["character-set-server"] = "utf8";

$config["collation-server"] = "utf8_unicode_ci";


My meta tags

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content ="width=device-width, initial=scale=1.0">

<meta name="description" content="The website for the Japan Kauri Education Trust">
<meta name="keywords" content="JKET, New Zealand,Japan Kauri Education Trust, Japan Heritage center, Japanese Childrens library, Japan, Japanese Classes">
<meta name="author" content="ガーネル華">

Please provide a link to your website so we can check for ourselves. Thank you.

Hi the page in question is

Add this inside your HTML file?

<meta charset="utf-8">

edit: I didn’t see it lmao

Its already there, as i said above?

What I found weird is that other Japanese characters are showing correctly in your site while those in the boxes are not.

Try using F12 Developer Mode to check if any errors are present.

Its a problem with the connection of the MySQL server and whats being echoed from the server on to the page. I’ve looked everywhere online but it still doesnt seem to work

Could you show the screenshot of your database where the values are stored?

I am unable to pinpoint the problem.

Please try to wrap your text in utf8_encode() before printing them and see if it works.

For example:

$text = utf8_encode($result['Description']);
echo $text;

I am getting blank results, Am I doing this right?

Okay. This is my last attempt.

Undo what I told you with utf_encode() and do the following:

$mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME); 
mysqli_set_charset($mysqli, "utf8");

It still doesn’t work, but thanks for trying :slight_smile:

I am sorry, but I don’t really understand why it is not working. If you could, ask for help on Stackoverflow. They will guide you better. As far as I know, this is not Infinityfree’s fault.

1 Like

I found a solution from StackOverFlow. Can you try this:

phpMyAdmin has some… issues with special characters. The database should be fine if you read and write your data from your own PHP code. But adding data through phpMyAdmin and reading it through PHP, or vice versa, can give some encoding issues.


Thank you so much!

We’re glad to help!