Function

Giodbus_escape_object_path_bytestring

since: 2.68

Declaration

gchar*
g_dbus_escape_object_path_bytestring (
  const guint8* bytes
)

Description

Escapes bytes for use in a D-Bus object path component. bytes is an array of zero or more nonzero bytes in an unspecified encoding, followed by a single zero byte.

The escaping method consists of replacing all non-alphanumeric characters (see g_ascii_isalnum()) with their hexadecimal value preceded by an underscore (_). For example: foo.bar.baz will become foo_2ebar_2ebaz.

This method is appropriate to use when the input is nearly a valid object path component but is not when your input is far from being a valid object path component. Other escaping algorithms are also valid to use with D-Bus object paths.

This can be reversed with g_dbus_unescape_object_path().

Available since: 2.68

Parameters

bytes

Type: An array of guint8

The string of bytes to escape.

The array must be NULL-terminated.
The data is owned by the caller of the function.

Return value

Type: gchar*

An escaped version of bytes. Free with g_free().

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.