GLib.Uri.parse_params
Description: Reference for GLib.Uri.parse_params

### Function

# GLib Uriparse_params

since: 2.66

#### Declaration [src]

    GHashTable*
    g_uri_parse_params (
      const gchar* params,
      gssize length,
      const gchar* separators,
      GUriParamsFlags flags,
      GError** error
    )

#### Description [src]

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 `GUriParamsIter`.

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 g_uri_parse(). (However, if `params` is the path or query string from a `GUri` 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 g_uri_params_iter_init().

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 `error` is set and `NULL` is returned.

Available since: 2.66

#### Parameters

`params`

  Type: `const gchar*`

  A `%`-encoded string containing `attribute=value` parameters.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`length`

  Type: `gssize`

  The length of `params`, or `-1` if it is nul-terminated.

`separators`

  Type: `const gchar*`

  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.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`flags`

  Type: `GUriParamsFlags`

  Flags to modify the way the parameters are handled.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GHashTable`

    A hash table of attribute/value pairs, with both names and values
    fully-decoded; or `NULL` on error.

The caller of the function takes ownership of the data, and is responsible for freeing it.