2012-03-29 2 views
0

내가 다음 JSON 데이터가 ... YAJLiOS 파서에 대해 질문이 있습니다 : "안녕하세요"YAJLiOS는 영어 이외의 문자를 구문 분석 할 수 없습니까?

"\의 U0416의 \의 U0412"과 :

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

을하고 난 "몸"을 얻으려고, 결과는

그것은 인코딩 문제가있을 수 있습니다,하지만 난 당신의 시간이

감사를 해결하는 방법에 대해 아무 생각이 없다!

+0

구문 분석을 수행하는 곳의 코드를 표시 할 수 있습니까? 확인 – jonkroll

+0

: 는 NSString *의 getFriendDialogs = [있는 NSString stringWithFormat : @ "https://api.vk.com/method/messages.getHistory?access_token=%@&uid=%@&chat_id=uid&count=10"currentAccessToken, UidOfSelectedFriend] ; NSURL * url = [NSURL URLWithString : getFriendDialogs]; NSURLRequest * requestObj = [NSURLRequest requestWithURL : url]; NSData * tempContainer = [NSURLConnection sendSynchronousRequest : requestObj returningResponse : nil 오류 : nil]; NSDictionary * dialogsDictionary = [tempContainer yajl_JSON]; idString = [dialogsDictionary valueForKey : @ "body"]; – ignotusverum

답변

0

먼저 UTF-8 문자 인코딩을 처리하기 위해 문자열로 변환해야 할 수도 있습니다.

NSData *tempContainer = [NSURLConnection sendSynchronousRequest:requestObj returningResponse:nil error:nil]; 

NSString *tempString = [NSString stringWithUTF8String:[tempContainer bytes]]; 

NSDictionary *dialogsDictionary = [tempString yajl_JSON]; 
+0

감사하지만이 도움이되지 않습니다; ( – ignotusverum

+0

다른 문자 인코딩을 사용할 수 있습니까? – ignotusverum

+0

NSData tempContainer = [NSURLConnection sendSynchronousRequest : requestObj returningResponse : nil 오류 : nil]; NSString 내용 = [[NSString alloc] initWithData : tempContainer 인코딩 : NSUTF8StringEncoding];이 코드를 사용할 때는 모두 괜찮지 만 nsdictionary가 필요하지는 않습니다. – ignotusverum