0

the web service I'm connecting to returns NSString with escaped characters in it e.g. @ Painful will be returned as %40+Painful

Is there a way to replace %40 with it's original @ which I need to do before displaying in the app

Note: am working on iOS7

inforeqd
  • 3,209
  • 6
  • 32
  • 46
  • Perhaps you could consider using the routine in this answer http://stackoverflow.com/questions/2673207/c-c-url-decode-library – clancer Feb 04 '14 at 05:20

1 Answers1

0

as with so many problems, the solution turned out to be simpler that I believed it would...

    NSString *s = [@"%40 Painful" stringByReplacingOccurrencesOfString:@"+" withString:@" "];
    s = [s stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; //This give s=@ Painful

thanks Apple!

inforeqd
  • 3,209
  • 6
  • 32
  • 46