views:

203

answers:

4

Hi,

I want to decode my string. I have used parsing and get a string from RSS feed. In a string these special characters are not allowed &,<,> in my app. In server side encoding those characters and give it to the string. So now i got the string like,

 Actual String : <Tom&Jerry>  (only these characters are not allowed in node data & < >).

 After Encoding:  %3CTom%26Jerry%3E.

But i need to display the string is

                  <Tom&Jerry>

So how can i decode the string.

Please help me out.

Thanks.

+1  A: 

Use the -stringByReplacingPercentEscapesUsingEncoding: method.

[@"%3CTom%26Jerry%3E"
 stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
KennyTM
@Pugal: Please `NSLog(@"%@", currentString2);`
KennyTM
+1  A: 

Look for

- (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)encoding 
Allisone
+2  A: 

Hi ,

I got the answer and my code is,

     NSString *currentString =@"%3CTom%26Jerry%3E";

     NSString  * decodeString = [currentString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    lblTitle.text = decodeString;

Thanks.

Pugal Devan
A: 

Thanx a lot man!!!!!!!!!!!!

AshishSudra