Skip to main content

Posts

Showing posts with the label encode

Sending encoded XML to a server from iPhone

I'm communicating between an iPhone app and a server using XML. To get around the problem of the user entering any character that might break the XML before I send it to the server i'm using the NSString method: [string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; But I noticed when doing a log of the string that the & symbol is not escaped? I thought that it should be? spaces, quotation marks and hash symbols which I've tested for all encode fine but not the ampersands? What is the most common methods used for encoding/decoding XML sent to/received from a server? Thanks.