escape_as_identifier


Description:


public string escape_as_identifier (string name)

Escape an arbitrary string so it follows the rules for a C identifier, and hence an object path component, interface element component, bus name component or member name in D-Bus.

Unlike g_strcanon this is a reversible encoding, so it preserves distinctness.

The escaping consists of replacing all non-alphanumerics, and the first character if it's a digit, with an underscore and two lower-case hex digits:

"0123abc_xyz\x01\xff" -> _30123abc_5fxyz_01_ff

i.e. similar to URI encoding, but with _ taking the role of typeof ( unichar2), and a smaller allowed set. As a special case, "" is escaped to "_" (just for completeness, really).

Parameters:

name

The string to be escaped

Returns:

the escaped string, which must be freed by the caller with g_free


Namespace: TelepathyGLib
Package: telepathy-glib