GLib.uri_escape_string

function uri_escape_string(unescaped: String, reserved_chars_allowed: String, allow_utf8: Boolean): String {
    // Gjs wrapper for g_uri_escape_string()
}
  

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.

Since 2.16

unescaped

the unescaped input string.

reserved_chars_allowed

a string of reserved characters that are allowed to be used, or null.

allow_utf8

true if the result can include UTF-8 characters.

Returns

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