Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unknown characters %252B in url

i have a page with links gotten from rss. they are: broken link

http://news.asiaone.com/News/Latest%252BNews/Singapore/Story/A1Story20121220-390687.html

working link

http://news.asiaone.com/News/Latest%2BNews/Singapore/Story/A1Story20121220-390687.html

i realise it works by changing %252B to %2B. im using php. is there a way to detect and correct it on the run?

like image 552
chrizonline Avatar asked Dec 20 '12 08:12

chrizonline


People also ask

What special characters are allowed in URLs?

A URL is composed of a limited set of characters belonging to the US-ASCII character set. These characters include digits (0-9), letters(A-Z, a-z), and a few special characters ( "-" , "." , "_" , "~" ). When these characters are not used in their special role inside a URL, they must be encoded. Question mark (“?”)

What is %2f in a URL?

URL encoding converts characters into a format that can be transmitted over the Internet. - w3Schools. So, "/" is actually a seperator, but "%2f" becomes an ordinary character that simply represents "/" character in element of your url. Follow this answer to receive notifications.


1 Answers

The URL has been double encoded. %25 is the escape sequence for "%", so a regular %2B got escaped again to %252B.

urldecode the value, but better avoid double-encoding it to begin with if possible.

like image 74
deceze Avatar answered Sep 27 '22 20:09

deceze