### Function

# GLib strescape

#### Declaration [src]

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

#### Description [src]

It replaces the following special characters in the string `source` with their corresponding C escape sequence:

Symbol | Escape
--- | ---
U+0008 Backspace | `\b`
U+000C Form Feed | `\f`
U+000A Line Feed | `\n`
U+000D Carriage Return | `\r`
U+0009 Horizontal Tabulation | `\t`
U+000B Vertical Tabulation | `\v`

It also inserts a backslash (`\`) before any backslash or a double quote (`"`). 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 backslash followed by their octal representation. Characters supplied in `exceptions` are not escaped.

`g_strcompress()` does the reverse conversion.

#### Parameters

`source`

  Type: `const gchar*`

  A string to escape.

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

`exceptions`

  Type: `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 value is a NUL terminated UTF-8 string.

#### Return value

Type: `gchar*`

A newly-allocated copy of `source` with special characters escaped.

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.