encode :: [Char] -> [Char] decode :: [Char] -> [Char] encodeQuery :: [([Char], [Char])] -> [Char] decodeQuery :: [Char] -> [([Char], [Char])]
The function encode
converts a string by escaping special characters, returning a string suitable for use in a
URL. The function decode
undoes the effect of encode
When the contents of a form (here referred to as a query) is submitted to a web server, it is encoded as a sequence of pairs of field names and values in the following way:
field_1=value_1&...&field_n=value_n
Special characters, like =
, &
and spaces, occuring in the field
names and values, are escaped, as with the function encode
.
The functions encodeQuery
and decodeQuery
convert to and from the
above form, applying encode
and decode
, respectively, to the
parts of the query.
encode "Sixth Sense, The (1999)" = "Sixth+Sense%2C+The+%281999%29"deocdeQuery "year=1999&actor=Willis%2C+Bruce" = [("year","1999"),("actor","Willis, Bruce")]
The Computing dictionary entry for URL.