Many URI schemes include one or more attribute/value pairs as part of the URI value.
This method can be used to parse them into a hash table. When an attribute has multiple occurrences, the last value is the final returned value. If you need to handle repeated attributes differently, use UriParamsIter .
The params
string is assumed to still be `%`-encoded, but the returned values will be fully decoded. (Thus it is possible
that the returned values may contain `=` or separators
, if the value was encoded in the input.) Invalid `%`-encoding is
treated as with the g_uri_flags_parse_relaxed rules for
parse. (However, if params
is the path or query string from a
Uri that was parsed without g_uri_flags_parse_relaxed and
g_uri_flags_encoded, then you already know that it does not contain any invalid encoding.)
g_uri_params_www_form is handled as documented for UriParamsIter.
If g_uri_params_case_insensitive is passed to flags
, attributes will be compared
case-insensitively, so a params string `attr=123&Attr=456` will only return a single attribute–value pair, `Attr=456`. Case will be
preserved in the returned attributes.
If params
cannot be parsed (for example, it contains two separators
characters in a row), then
throws is set and null is returned.
length |
the length of |
separators |
the separator byte character set between parameters. (usually `&`, but sometimes `;` or both `&;`). Note that this function works on bytes not characters, so it can't be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur. |
flags |
flags to modify the way the parameters are handled. |
params |
a `%`-encoded string containing `attribute=value` parameters |
A hash table of attribute/value pairs, with both names and values fully-decoded; or null on error. |