Pages

Decode a UTF8 encoded NSString

While programming in iOS sometime we have to hit certain URLs which in turn returns Encoded string.Which we have to decode to get the actual string.

NSString *currentEncodedString =@"%3CTom%26Jerry%3E"; //Received Encoded UTF8 String
NSString *currentDecodedString = [currentEncodedString
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"My Current Decoded String: %@",currentDecodedString);