Pike v8.0 release 1738

Method Protocols.HTTP.http_encode_query()


Method http_encode_query

string http_encode_query(mapping(string:int|string|array(string)) variables)

Description

Encodes a query mapping to a string; this protects odd - in http perspective - characters like '&' and '#' and control characters, and packs the result together in a HTTP query string.

Example:

	> Protocols.HTTP.http_encode_query( (["anna":"eva","lilith":"blue"]) );  
     Result: "lilith=blue&anna=eva"
     > Protocols.HTTP.http_encode_query( (["&":"&","'=\"":"\0\0\0"]) );  
     Result: "%26amp%3b=%26&%27%3d%22=%00%00%00"