Removing %2520 and other nonstandard characters from URL in obj c

13,441

Solution 1

%2520 is simply a double-encoded space. Encode it once and you get %20, encode it twice and you get %2520. It's not "non-standard", it's just poorly coded. In theory, there's no reason why you can't just replace %2520 with a space, but for all I know the server-side code is expecting the double-encoded string.

Solution 2

Found the answer.I am removing the encoding using the built in function of iOS.abc = [def stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

and i am loading abc in webview.It is working fine. Thanks all for the responses.

Solution 3

You seem to have an urlencode() too many, or an urldecode() too few, in the code processing the URL server side.

Share:
13,441
dead_soldier
Author by

dead_soldier

Updated on June 04, 2022

Comments

  • dead_soldier
    dead_soldier almost 2 years

    I am getting a URL from server and trying to load the URL in webview. The issue is that the url which I am getting contains non standard characters. The URL is:

    https//p-r3.test.abc.com:443%2Ftablet%2Fjsp%2Fgift%2Fipad%2Fgifter%2FgitGiftList.jsp%3FregId%3D74500002%26filterBy%3DviewAll%26pageId%3DourGifty%26sort%3Dcategory%26groupBy%3Dcategory%26view%3Dlist%26categoryId%3D%26addCat%3Dcat100540004&title=re%20-&imgurl=https%3A%2F%2Fm-r3-testy.tr.com%3A443%2Ftablet%2Fimages%2Ft_Full.jpg%3Fwid%3D300%26hei%3D300.
    

    I need to remove characters like %2520, %2F, %3D and other non standard characters from the URL. Anyone has idea to remove this encoding.
    Any help would be appreciated

    Thanks