Function

GLibstrescape

Declaration [src]

gchar*
g_strescape (
  const gchar* source,
  const gchar* exceptions
)

Description [src]

Escapes the special characters ‘\b’, ‘\f’, ‘\n’, ‘\r’, ‘\t’, ‘\v’, ‘' and ‘”’ in the string source by inserting a ‘' before them. Additionally all characters in the range 0x01-0x1F (everything below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are replaced with a ‘' followed by their octal representation. Characters supplied in exceptions are not escaped.

g_strcompress() does the reverse conversion.

Parameters

source const gchar*
 

A string to escape.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
exceptions const gchar*
 

A string of characters not to escape in source.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.

Return value

Returns: gchar*
 

A newly-allocated copy of source with certain characters escaped. See above.

 The caller of the function takes ownership of the data, and is responsible for freeing it.
 The string is a NUL terminated UTF-8 string.