Function

GLibUriunescape_bytes

since: 2.66

Declaration [src]

GBytes*
g_uri_unescape_bytes (
  const char* escaped_string,
  gssize length,
  const char* illegal_characters,
  GError** error
)

Description [src]

Unescapes a segment of an escaped string as binary data.

Note that in contrast to g_uri_unescape_string(), this does allow nul bytes to appear in the output.

If any of the characters in illegal_characters appears as an escaped character in escaped_string, then that is an error and NULL will be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.

Available since: 2.66

Parameters

escaped_string

Type: const char*

A URI-escaped string.

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

Type: gssize

The length (in bytes) of escaped_string to escape, or -1 if it is nul-terminated.

illegal_characters

Type: const char*

A string of illegal characters not to be allowed, 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.
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: GBytes

An unescaped version of escaped_string or NULL on error (if decoding failed, using G_URI_ERROR_FAILED error code). The returned GBytes should be unreffed when no longer needed.

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