[英]ios json parse with afnetworking
嗨:)我在解析json數據時第一次在網絡服務中遇到重音單詞問題,但我將其修復
<?php
header('Content-Type: text/json; charset=utf-8');
include('settings.php');
mysql_connect($host,$user,$password);
mysql_select_db($base);
mysql_query('SET CHARACTER SET utf8');
$req = "select * from patient";
$sql=mysql_query($req);
$nn=mysql_num_rows($sql);
$items = array("items" => NULL);
while ($data=mysql_fetch_array($sql))
{
$items["items"][] = array(
"id_patient" => $data['id_patient'],
"nom" => $data['nom'],
"prenom" => $data['prenom'],
"Sexe" => $data['Sexe'],
"date_de_naissance" => $data['date_de_naissance'],
"lieu_de_naissance" => $data['lieu_de_naissance'],
"adresse" =>$data['adresse'],
"latitude" => $data['latitude'],
"longitude" => $data['longitude'],
"telephone" => $data['telephone'],
"email" => $data['email'],
"situation_familiale" => $data['situation_familiale'],
"profession" => $data['profession'],
"numero_securite_sociale" => $data['numero_securite_sociale'],
"taille" => $data['taille'],
"poids" => $data['poids'],
"situation_familiale" => $data['situation_familiale'],
"groupe_sanguin" => $data['groupe_sanguin'],
"allergies" =>$data['allergies'],
"antecedents_chirurgicaux" => $data['antecedents_chirurgicaux'],
"antecedents_medicaux" => $data['antecedents_medicaux'],
"antecedents_familiaux" => $data['antecedents_familiaux'],
);
}
echo json_encode($items,JSON_UNESCAPED_UNICODE);
?>
in the server its good im getting it fine
"allergies":poussiére
但是當我用afnetworking解析它時,我的皮膚過敏=“ poussi \\ U00e9re”;
誰能幫助我:) thx
在您的請求方法中添加此
[AFJSONRequestOperation addAcceptableContentTypes:
[NSSet setWithObject:@"text/json"]];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.