I have a table in sqlserver 2012 which may contain some questions in hindi font (web standard mangal font) like
A) आरोग्यमुल✔.
I want to retrieve the questions in php. I have developed a JSON web service in PHP to display the questions as per my knowledge I have put header
('Content-Type: application/json; charset=utf-8');
and
echo json_encode($return_arr,JSON_UNESCAPED_UNICODE);
statement but still web service display ?????????? symbols in behalf of hindi font. this problem only arise with sqlserver and php. if i have develop same web service in asp.net it work fine and if i have develop it in php with mysql database then again it works fine. I am unable to trace what is issue with sqlserver of php.
Hindi Text Solution in ASP.NET
I have solved the problem in asp.net web service by using this code : string jsonstring = UTF8Encoding.UTF8.GetString(ms.ToArray());. I have data in memory stream object.
Hindi Text Solution in PHP Web Service i have got the solution. Solution in php webservice is during creating the connection object of sqlserver you need to set CharacterSet for example : $connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>"schoolapp_db", "CharacterSet"=>"UTF-8");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With