Skip to content Skip to sidebar Skip to footer

How To Send & Symbol In Xml Body To Server

I am trying to send the & symbol to the server in an XML body but only received a blank. I tried HTML code to send this also but in vain.

Solution 1:

You can create a category on NSString and then encode few characters that you cant send directly... few are implemented below:

@implementationNSString (URLEncoding)

- (NSString *) stringByUrlEncoding{
    return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,  (CFStringRef)self,  NULL,  (CFStringRef)@"!*'();:@&;=+$,/?%#[]",  kCFStringEncodingUTF8));
}

@end

Solution 2:

You can use the HTML entity:

&

For a full list of the HTML character entities see this.

Post a Comment for "How To Send & Symbol In Xml Body To Server"