Jump to content

Query string

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 193.8.145.2 (talk) at 17:51, 20 July 2004 ([[URL Encoding]]). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A query string is the part of a URL that conveys parametric data to the server.

Syntax

The basic syntax is ?parameter1=value1&parameter2=value2 . . .

  • The query string starts with a question mark.
  • Then follows a series of parameter=value pairs. For example, Message=hello.
  • The parameter-value pairs are each separated by an equal sign.
  • The series of pairs is separated by the ampersand, '&'.


Spaces, ampersands, equal signs, and many other characters could cause trouble with the URL and the query string. Therefore the value in each parameter-value pair is URL-Encoded. This is a process by which each of these troublesome characters is converted into a numeric represenctation.

'%2D' is one such example.

  • The percent sign signals the start of such a string.
  • '2D' is the number 45 in HEX - in ASCII and UNICODE, each character has a numerical index.

Therefore, %2D is the minus sign, and %25 is the percent character.

  • Spaces are converted to plus signs, e.g. "hello there" would be converted to "hello+there".

xxx

See also

Email Attachments

  • online encoders and decoders for educational purposes

[1]