escape_bytes


Description:

[ Version ( since = "2.66" ) ]
public static string? escape_bytes (uint8[] unescaped, string? reserved_chars_allowed = null)

Escapes arbitrary data 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.

Though technically incorrect, this will also allow escaping nul bytes as `%``00`.

Parameters:

unescaped

the unescaped input data.

reserved_chars_allowed

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

length

the length of unescaped

Returns:

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