GLib.Uri.escape_string
Description: Reference for GLib.Uri.escape_string

### Function

# GLib Uriescape_string

since: 2.16

#### Declaration

    char*
    g_uri_escape_string (
      const char* unescaped,
      const char* reserved_chars_allowed,
      gboolean allow_utf8
    )

#### Description

Escapes a string for use in a URI.

Normally all characters that are not “unreserved” (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in `reserved_chars_allowed` they are not escaped. This is useful for the “reserved” characters in the URI specification, since those are allowed unescaped in some portions of a URI.

Available since: 2.16

#### Parameters

`unescaped`

  Type: `const char*`

  The unescaped input string.

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

`reserved_chars_allowed`

  Type: `const char*`

  A string of reserved characters that are allowed to be used, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`allow_utf8`

  Type: `gboolean`

  `TRUE` if the result can include UTF-8 characters.

#### Return value

Type: `char*`

An escaped version of `unescaped`. The returned string should be freed when no longer needed.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.