samedi 18 avril 2015

How to json encode UTF-8 type String on Xcode


Vote count:

0




i want to get JSON from URL and encode NSString to show on NSLog. JSON contain Chinese works . how to do this ?



enter code here


NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];



[request setURL:[NSURL URLWithString:@"http://ift.tt/1G69ili"]];

[request setHTTPMethod:@"GET"];


NSURLResponse *requestResponse;


NSData *requestHandler = [NSURLConnection sendSynchronousRequest:request returningResponse:&requestResponse error:nil];



NSString *requestReply = [[NSString alloc] initWithBytes:[requestHandler bytes] length:[requestHandler length] encoding:NSUTF8StringEncoding];


NSLog(@"requestReply: %@", requestReply);



asked 1 min ago







How to json encode UTF-8 type String on Xcode

Aucun commentaire:

Enregistrer un commentaire