Below my code i try this solution but not work it. and also i give utf8_unicode_ci for hindi and utf8_bin for Gujarati Language in database Collation.
Please Help me how i fetch data Hindi & Gujarati Language.
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<?php
session_start();
require_once('config.php');
$JSONoutput = array();
$q=mysqli_query($con,"SELECT * FROM tbl_Hindi");
header('Content-Type: text/html; charset=UTF-8');
while($rs=mysqli_fetch_assoc($q))
{
$JSONoutput['SMS'][] = array("ID"=>$rs['ID'],"Message"=>$rs['Message']);
}
print(json_encode($JSONoutput));
?>
Output:
{"SMS":[{"ID":"1","Message":"?? ????? ?? ??? ???? ??, ???? ?? ???? ??? ?? ????? ?? ?? ???? ?? ??????"},{"ID":"2","Message":"???? ????? : ??? ???? ?? ? ????? ????? : shopping ???? ?? ??? ???? ????? : : ???? ?? ???? ? ????? ????? : ???? ??? ??? ?? Gf ?? ? ???? ????? : ?? ?? ??? ??? ?? ? ????? ????? : ?? ???? "}]}
ALTER TABLE tbl_Hindi
CHANGE Message
Message
VARCHAR( 50 ) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL ;
Try this query
See https://stackoverflow.com/a/38363567/1766831 -- In particular the discussion of "Question marks". It says
The question marks are already in the database table; the original data is lost.
Do not us ucs2 or utf16; use only utf8 or utf8mb4.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.