0

Hi i have data stored in hindi in mysql server and am unable to show it as output here is my code

<?php
//string utf8_decode(string $product);
/*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');*/
header( 'Content-Type: text/html; charset=utf-8' ); 


// array for JSON response
$response = array();



require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();


$result = mysql_query("SELECT *FROM create_event") or die(mysql_error());


if (mysql_num_rows($result) > 0) {
    // looping through all results
    // products node
    $response["create_event"] = array();

    while ($row = mysql_fetch_array($result)) {
        // temp user array
        $product = array();
        $product["eventid"] = $row["eventid"];
        $product["description"] = $row["description"];
        $product["title"] = $row["title"];
        $product["startdate"] = $row["startdate"];
        $product["enddate"] = $row["enddate"];




        // push single product into final response array
        array_push($response["create_event"], $product);
    }
    // success
    $response["success"] = 1;

    // echoing JSON response
    echo json_encode($response, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT |  JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
} else {
    // no products found
    $response["success"] = 0;
    $response["message"] = "No products found";

    // echo no users JSON
    echo json_encode($response, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT |      JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
}
?>

the data is stored in utf8_unicode_ci format in mysql server
and here is the output i am getting from php code in browser

{"create_event":     

[{"eventid":"1","description":"????????","title":"?????","startdate":"5-12-12","enddate":"5-12-45"}],"success":1}

the data with value ???????? k is the data which is stored in hindi.Kindly,help me on this as i am new in php.
Thanks!!!

Passerby
  • 9,715
  • 2
  • 33
  • 50
  • 1
    possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through), [Handling Unicode Front To Back In A Web App](http://kunststube.net/frontback/) – deceze Jan 29 '14 at 11:05

1 Answers1

-1

http://rafeekphp.wordpress.com/2009/06/10/multi-language-support-in-mysql/

If the result shows like the ???? then prpoerly in your system (windows XP) need to install the extral language support tool by enabling the following options,

Control Panel -> Regional and Language Option -> Languages -> Install files for complex script and right-to-left languages (including Thai)

Community
  • 1
  • 1
WBO Co.
  • 245
  • 2
  • 12