1

My app receives some data from server which is in XML format and some tags contains Japanese words. When I tried to execute the link in the browser, it gets the correct response in Japanese. For example:

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

..but in my app, the response string is in some encoded format like the following:

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

My code to receive XML from the server is:

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

Is there a problem with my code? How can I convert the response to correct Japanese strings?

Makoto
  • 104,088
  • 27
  • 192
  • 230
Johnykutty
  • 12,091
  • 13
  • 59
  • 100

1 Answers1

0

Try looking at some of the decoding methods listed on this question: HTML character decoding in Objective-C / Cocoa Touch

Community
  • 1
  • 1
oojoe
  • 133
  • 1
  • 12