2012-03-28 71 views
1

我的應用程序從服務器接收一些XML格式的數據,一些標籤包含日語單詞。當我試圖在瀏覽器中執行鏈接時,它會以日文獲得正確的回覆。例如:客觀c字符串編碼問題

<root> 
    <categorylist> 
     <cid>19</cid> 
     <cname>ファミリー</cname> 
     <lang>jap</lang> 
    </categorylist> 
</root> 

..但在我的應用程序,響應字符串是類似於下面的一些編碼格式:

<root> 
    <categorylist> 
     <cid>19</cid> 
     <cname>&#x30D5;&#x30A1;&#x30DF;&#x30EA;&#x30FC;</cname> 
     <lang>jap</lang> 
    </categorylist> 
</root> 

我的代碼從服務器接收XML是:

NSString *[email protected]"http://www.myserver.com/category.php?lang=jap";  
    NSString *resultString=[NSString stringWithContentsOfURL:[NSURL URLWithString:req] encoding:NSUTF8StringEncoding error:nil]; 

我的代碼有問題嗎?如何將響應轉換爲正確的日文字符串?

+2

那些是正確編碼XML Unicode代碼點;那些*是*正確的日語字符串。 – zmccord 2012-03-28 19:07:36

回答