1

When I query in MySQL then it returns in Japanese Character. An image is attached below.

enter image description here

But in browser its shown "????". An image is attached below. enter image description here

Here I enclose my base.html code.

<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link media="screen" href="<?php echo $this->path_to('/common/css/import.css') ?>" type="text/css" rel="stylesheet" />

<script src="<?php echo $this->path_to('/common/js/jquery-2.1.0.min.js') ?>"></script>
<title><?php echo $this->v('page_title') ?></title>
</head>
<body>
<?php echo $this->part_of('body') ?>
</body>
</html>
Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Md Rasel Ahmed
  • 1,025
  • 9
  • 12
  • 2
    Possible duplicate of [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) –  May 11 '18 at 06:33
  • You need to set your charset, and UTF8 should work. See the flagged duplicate above, or [**this answer** I have previously written](https://stackoverflow.com/a/31899827/4535200) about UTF8, which contains a nice little checklist for the most things that needs to have a specified charset in a PHP/MySQL application. – Qirel May 11 '18 at 06:37
  • 1
    Thanks all. I solved the problem as given below. SELECT column1, CAST(CONVERT(column2 USING utf8) AS binary) FROM my_table WHERE my_condition; – Md Rasel Ahmed May 11 '18 at 07:25
  • https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html – Md Rasel Ahmed May 11 '18 at 07:25
  • See "question mark" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James May 15 '18 at 17:49

1 Answers1

0

Use mysqli_set_charset($db,'utf8'); in your dbconnection file. in my case $db is my connection variable

Sachin
  • 397
  • 4
  • 13