2014-03-19 93 views
0
與重音字有問題

喜:)即時消息時,我解析JSON數據 這是第一次在Web服務,但我固定它IOS JSON解析與afnetworking

<?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

+0

只有當你登錄的內容或還當你在屏幕上顯示呢? – Wain

+0

它只在日誌中我沒有嘗試顯示它 –

+0

嘗試顯示它,應該很好 – Wain

回答

0

在你請求的方法添加此

[AFJSONRequestOperation addAcceptableContentTypes: 
         [NSSet setWithObject:@"text/json"]];