0

I am using AFNetworking to fetch data from the server.

When there is an accented character in my URL I get an error like this:

userInfo={"NSUnderlyingError"=>#<__NSCFError:0xfd3aa70, description="bad URL", code=-1000, domain="kCFErrorDomainCFNetwork", userInfo={"NSLocalizedDescription"=>"bad URL"}>, "NSLocalizedDescription"=>"bad URL"}>

However, when I try the URL from a browser (chrome), my backend API returns the results fine.

Here is a sample URL I'm trying: http://localhost:9000/my/JalapeƱos

Anthony
  • 33,838
  • 42
  • 169
  • 278

1 Answers1

0

A URL requires to be properly encoded. Given your example is a string representing a URI, it's definitely wrong.

You may take a look at NSURLComponents (available for OSX >= 10.9 and iOS >= 7.0) and RFC 3986.

Community
  • 1
  • 1
CouchDeveloper
  • 18,174
  • 3
  • 45
  • 67