Home >

URL Encoding Special Characters Reference

3. March 2011

Several characters have special meaning in different parts of the HTTP request. Following is the quick reference of various special characters whoose encoding you should know as a web developer:

  • & is used to separate parameters in the URL query string and message body. To insert a literal & character, you should encode this as %26
  • = is used to separate the name and value of each parameter in the URL query string and message body. To insert a literal = character, you should encode this as %3d
  • ? is used to mark the beginning of the URL query string. To insert a literal ? character, you should encode this as %3f
  • A space is used to mark the end of the URL in the first line of requests, and can indicate the end of a cookie value in the Cookie header. To insert a literal space you should encode this as %20 or +
  • Because + represents an encoded space, to insert a literal + character, you should encode this as %2b
  • ; is used to separate individual cookies in the Cookie header. To insert a literal ; character, you should encode this as %3b
  • # is used to mark the fragment identifier within the URL. If you enter this character into the URL within your browser, it will effectively truncate the URL that is sent to the server. To insert a literal # character, you should encode this as %23
  • % is used as the prefix in the URL-encoding scheme. To insert a literal % character, you should encode this as %25
  • Any nonprinting characters such as null bytes and newlines must, of course, be URL-encoded using their ASCII character code - in this case, as %00 and %0a, respectively

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading