NSURL does not support the use of curly braces (i.e. {}) in URLs. My application needs to talk to a server that requires the use of curly braces in the URL. I’m considering using bridges to write the networking code in Python or C++, or even rewriting the C code for NSURL to make it accept curly braces. Percent escapes are not accepted by my remote server.
Do I have any other good alternatives?
EDIT: Explained why addingPercentEscapesUsingEncoding and the like don’t work for me here.
Will it work for you if you escape the braces?
This code:
Outputs:
So, escaping seems to work
Here’s how you can programmatically escape the url:
EDIT:
In your comment below, you said your server won’t accept encoded braces and was there any other alternatives. First, I would try and get the server fixed. If that’s not possible … I haven’t tried this with braces etc… but the layer below NS networking classes is CFNetworking.
See this:
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFHTTPTasks/CFHTTPTasks.html#//apple_ref/doc/uid/TP30001132-CH5-SW2
From that doc:
Once again, haven’t tried it and I’m running out. might try it later but if a layer isn’t working your first options are to move down the stack.