I am working with a system which html code was set to Shift-JIS and mysql database was set to utf8_general_ci
as following:
ãŠè¿”äº‹é ‚ã„ãŸã‚ˆã†ã§ã™ãŒ
返信文...
Now, I have developed a php and android code to transfer data from php to android. in php side,
<?php
require_once('dbConnect.php');
$user = $_POST['username'];
$sql = "SELECT * FROM `postcontents` WHERE id='$user' AND inside='0' order by date DESC";
$res = mysqli_query($con,$sql);
$result = array();
while($row = mysqli_fetch_array($res)){
array_push($result,
array('date'=> $row[6],
'name'=> $row[1],
'address'=> $row[2]
));
}
echo json_encode(array("result"=>$result));
mysqli_close($con);
?>
However, Json-encode in php file consider the information which is in mysql as rubbish data. Also, Json-encode may change the formant of the data. Therefore, I cannot show Jappanies in Android or browser. The output is null.
{"date":"0000-00-00 00:00:00","name":null,"address":null}
How can I fix this problem?
By the way, I have tested
A problem with passing Japanese characters(UTF-8) via json_encode
difficulty passing Japanese characters(UTF-8) via json_encode