Search code examples
iphoneobjective-cxcodeyajl

YAJLiOS can't parse non English letters?


i have question about YAJLiOS parser... I have next json data :

   {{
    body = "Привет";
    mid = 3;
    "read_state" = 1;
   }
   { body = "hi";
     mid = 3;
     "read_state" = 1;
    }}

and i'm trying to get "body" , result is : "\U0416\U0412" and "hi"

it might be problem with encoding, but i have no idea how to fix it

Thanks for your time!


Solution

  • You may need to convert to a string first to deal with the UTF-8 character encoding.

    NSData *tempContainer = [NSURLConnection sendSynchronousRequest:requestObj returningResponse:nil error:nil];
    
    NSString *tempString = [NSString stringWithUTF8String:[tempContainer bytes]];
    
    NSDictionary *dialogsDictionary = [tempString yajl_JSON];