Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL encoding yes/or no?

I have a restful webservice which receives some structured data which is put straight into a database.

The data is send from an OS using wget. I am just wondering whether I actually need to URL encode the data and if so why? Please note that it is no problem to do it but it might be uneccessary in this scenario.

like image 569
cs0815 Avatar asked Oct 14 '22 07:10

cs0815


1 Answers

If your data has characters that aren't allowed in urls, you should url encode it.

The following characters are either reserved (like &) or just present the possibility of confusing code. If your data contains these characters, urlencode it. Remember if you are using any extended ascii characters, unicode characters or non-printable characters you should url-encode your data.

  • Dollar ("$")
  • Ampersand ("&")
  • Plus ("+")
  • Comma (",")
  • Forward slash/Virgule ("/")
  • Colon (":")
  • Semi-colon (";")
  • Equals ("=")
  • Question mark ("?")
  • 'At' symbol ("@")
  • Space
  • Quotation marks
  • 'Less Than' symbol ("<")
  • 'Greater Than' symbol (">")
  • 'Pound' character ("#")
  • Percent character ("%")
  • Left Curly Brace ("{")
  • Right Curly Brace ("}")
  • Vertical Bar/Pipe ("|")
  • Backslash ("\")
  • Caret ("^")
  • Tilde ("~")
  • Left Square Bracket ("[")
  • Right Square Bracket ("]")
  • Grave Accent ("`")

More info can be found here: http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

like image 59
vfilby Avatar answered Oct 20 '22 16:10

vfilby