ios - fix while converting NSString to NSDictionary -
i getting nsstring * responsestring
below format utf8 encoded. data webserver database.
nsstring *jsonstring = @"{\"id\":{\"content\":\u0e09\u0e31\u0e19\u0e23\u0e31\u0e01\u0e04\u0e38\u0e13,\"type\":\"text\"},\"contracttemplateid\":{\"content\":\u0e09\u0e31\u0e19\u0e23\u0e31\u0e01\u0e04\u0e38\u0e13,\"type\":\"text\"}}"; //trying convert utf nsstring *utf = [jsonstring stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding]; //convert data nsdata *data = [utf datausingencoding:nsutf8stringencoding]; //trying create nsdictionary json id json = [nsjsonserialization jsonobjectwithdata:data options:0 error:nil]; nslog(@"json: %@", son); nslog(@"utf: %@", utf);
i need convert nsdictionary can parse , value of content
output results:
utf: (null) utf: {"id":{"content":ฉันรักคุณ,"type":"text"},"contracttemplateid":{"content":ฉันรักคุณ,"type":"text"}}
strings present unicode in debugger. show them labels or convert characters online tools.
Comments
Post a Comment