Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:46:52+00:00 2026-06-10T05:46:52+00:00

I just switched from ASIHTTPRequest to AFNetworking. My app allows a user to enter

  • 0

I just switched from ASIHTTPRequest to AFNetworking.

My app allows a user to enter a search term, and then I make an api call to my server (rails) to retrieve a list of relevant objects to display on the phone. Simple enough.

Too Long, Won’t Read

With the ASI library, the search term sent to the server would be something like st%20helena. Now, with the AFNetworking, my search term sent to the server is st%2520helena. Oddly enough, this is actually making a difference. With %20, I receive no results. With %2520, I receive the results I was expecting.

My question is, why does this make a difference? I know that %2520 is an encoded ‘%’ + 20, which equals a whitespace character, which in my mind should be identical to passing %20.

Details

Before, I was simply appending the search term to the URL after first encoding it:

NSString *encoded = [@"st helena" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *url = [NSString stringWithFormat:@"http://www.example.com/?=%@, encoded];

Now, with AFNetworking, I’m passing an NSDictionary to the parameters argument of AFHTTPClient#getPath.

NSString *encoded = [@"st helena" stringByAddingPercentEscapesUsingEncoding:NSUTR8StringEncoding];
NSDictionary *dict = @{ @"q" : encoded };
[[myClient sharedClient] getPath:@"" parameters:dict ...]

Since AFNetworking encodes items in the dictionary, my search string is being double encoded, which is why the % of ‘%20’ is being converted into ‘%25’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:46:54+00:00Added an answer on June 10, 2026 at 5:46 am

    My question is, why does this make a difference? I know that %2520 is an encoded ‘%’ + 20, which equals a whitespace character, which in my mind should be identical to passing %20.

    No, they aren’t identical. The parsing code isn’t supposed to just keep decoding over and over again until there aren’t any more percent signs left. If that were the case, it would be impossible to transmit the actual percent character. It’s only supposed to decode it once. This means that if %2520 goes over the wire, it is decoded into the data %20 and processing stops there. If %20 goes over the wire, it is decoded once into a space. The decoding is only supposed to happen once. If your web service is treating %2520 as a space, then it has a double-decoding bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just recently switched from ASIHttpRequest library to AFNetworking. I really like the simplicity,
Just switched from Botan 1.4 to Botan 1.10. Configure, make and install worked fine
I have just switched from using Emacs.app to emacs server and emacsclient in terminal
I just switched from Eclipse to IntelliJ and noticed that when I use Reformat
I just switched from Eclipse to IntelliJ. IntelliJ lacks one feature from Eclipse -
I just switched from storing my images uploaded via Carrierwave locally to using Amazon
So I just switched from some network solutions hosting running some php files that
I've just switched from radrails to netbeans. So far, so good. But I have
I have just switched from svn to mercurial and have read some tutorials about
Just switched over from eclipse to vs 2008 for debugging javascript, i feel more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.