Question

I am using an API that needs the | character in the URL. I tried changing that character to %7C, but the API rejects it. Now the issue is NSURLConnection gives me this if I include a | in the url:

 NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x610000272bc0 {NSLocalizedDescription=bad URL, NSUnderlyingError=0x600000247b60 "bad URL"}

How can include the | in my URL?

Was it helpful?

Solution

You can't: the pipe character is a so called unsafe character and must always be percent escaped to form a valid URL. See RFC 1738 for the syntax of a valid URL.

You should contact the developers of the service you are using and ask them to change this peculiarity of their API's behavior.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top