GLib.markup_escape_text
Description: Reference for GLib.markup_escape_text

### Function

# GLibmarkup_escape_text

since: 2.0

#### Declaration

    gchar*
    g_markup_escape_text (
      const gchar* text,
      gssize length
    )

#### Description

Escapes text so that the markup parser will parse it verbatim. Less than, greater than, ampersand, etc. are replaced with the corresponding entities. This function would typically be used when writing out a file to be parsed with the markup parser.

Note that this function doesn’t protect whitespace and line endings from being processed according to the XML rules for normalization of line endings and attribute values.

Note also that this function will produce character references in the range of … for all control sequences except for tabstop, newline and carriage return. The character references in this range are not valid XML 1.0, but they are valid XML 1.1 and will be accepted by the GMarkup parser.

Available since: 2.0

#### Parameters

`text`

  Type: `const gchar*`

  Some valid UTF-8 text.

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

`length`

  Type: `gssize`

  Length of `text` in bytes, or -1 if the text is nul-terminated.

#### Return value

Type: `gchar*`

A newly allocated string with the escaped text.

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.