0

I am developing website using php and mysql and i have stored Marathi data in database and displays on web page but its shows like ????????. To solve this i have used utf8 Unicode i have set database and table to utf8 also added below code in connection file after the connection $con = mysql_connect("localhost","root",""); function

mysql_query("SET character_set_results=utf8");
mysql_query("SET names=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET collation_connection=utf8_general_ci");

also set the $result = mysql_query("SET NAMES utf8"); before data fetch query the question mark problem solve now but the data displays "0au120bhu908hgsbdch761" like that.

James Z
  • 12,209
  • 10
  • 24
  • 44
  • With `php` you can use `utf8_encode()` and `utf8_decode()`. More about : http://php.net/manual/en/function.utf8-encode.php – Hamza Abdaoui Oct 14 '17 at 08:44
  • You need to read 'UTF-8 All the way through' - https://stackoverflow.com/a/279279/80836 – Andreas Oct 14 '17 at 08:54
  • in your head. and stop using mysql api. It is removed since php 7.0 – Saad Suri Oct 14 '17 at 08:56
  • I tried everything but still getting output u092cu0947u0938u093fu0915 u0915u0949u092eu094du092au0941u091fu0930 for the word बेसिक कॉम्पुटर in database table, any one can tell me step by step process to solve issue – Mayur Shinde Oct 15 '17 at 05:17

1 Answers1

0
  1. Do not use PHP's mysql_* interface. Switch to either mysqli_* or PDO.

  2. See this

  3. SELECT HEX(...) FROM ... ("Test the data", at the link) to see what got stored. For most Indian character sets, I would expect 3-byte does: E0 Ax yy or E0 Bx yy.

  4. See "Best Practice' (at the link); it may help you home in on what else needs fixing. Searching for question marks may help now.

Rick James
  • 135,179
  • 13
  • 127
  • 222