0

I am using two languages in my site i.e., English and Japanese.But when I am fetching japanese data from database whose collation is in utf8_unicode_ci,data is not showing in web page it is coming ????????????? like that in place of japanese data.

I also used

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in header section, then also data is not coming.

If anyone knows this,please help me out. Thanks!

Prince Kumar
  • 498
  • 3
  • 9
  • 30
  • I have tried that one also but still the problem is same.If the question is right, then you don't have right to give negative mark – Prince Kumar Apr 23 '14 at 11:44
  • http://stackoverflow.com/questions/1045338/which-is-the-best-character-encoding-for-japanese-language-for-db-php-and-html – Balázs Varga Apr 23 '14 at 11:44
  • This is almost certainly a character encoding mismatch. There should be plenty of other examples of how to solve this on SO – GordonM Apr 23 '14 at 11:44
  • What *exactly* have you "tried from that one"? You need to handle the encoding across three different layers (browser, PHP, database); you need to show us a little more than just one HTML meta tag. – deceze Apr 23 '14 at 11:46
  • It doesn't mean you will give the negative mark though the question is not wrong – Prince Kumar Apr 23 '14 at 11:47
  • The question has been answered a thousand times and you do not give enough information to diagnose where exactly your problem lies or what exactly you have tried to fix the problem based on the existing thousand answers → downvote. – deceze Apr 23 '14 at 11:48

1 Answers1

0

A meta-tag with content-type UTF-8 is not enough to indicate the web browser that your HTML page contains Unicode data.

Your problem can be solved on 2 axis:

1st axis: Respond with the appropriate HTTP header. In your case, the content-type should be "Content-Type: text/html; charset=utf-8'. This indicates the browser that the transmitted (responded) data is encoded in UTF-8. See this question: Set HTTP header to UTF-8 using PHP

2nd axis: Make sure the database data is transmitted from client to mysql in UTF-8. See the SET NAMES statement from the MySQL documentation: http://dev.mysql.com/doc/refman/5.0/fr/charset-connection.html. In your case, you should send SET NAMES 'UTF-8' to MySQL prior to any other SQL statements.

Community
  • 1
  • 1
Jérôme
  • 616
  • 5
  • 15