diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 8c42bce..891d0f4 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -2780,6 +2780,7 @@ g_utf8_find_next_char
 g_utf8_find_prev_char
 g_utf8_strlen
 g_utf8_strncpy
+g_utf8_strescape
 g_utf8_strchr
 g_utf8_strrchr
 g_utf8_strreverse
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 9509233..ff56d54 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -2075,6 +2075,11 @@ out:
  * replaced with a '\' followed by their octal representation.
  * Characters supplied in @exceptions are not escaped.
  *
+ * <note><para>
+ * To copy escapes special characters in UTF-8 encoded string, use
+ * g_utf8_strescape() instead.
+ * </para></note>
+ *
  * g_strcompress() does the reverse conversion.
  *
  * Returns: a newly-allocated copy of @source with certain
diff --git a/glib/gunicode.h b/glib/gunicode.h
index d51fa43..e63bb77 100644
--- a/glib/gunicode.h
+++ b/glib/gunicode.h
@@ -680,6 +680,11 @@ gchar   *g_utf8_strncpy           (gchar       *dest,
                                    const gchar *src,
                                    gsize        n);
 
+GLIB_AVAILABLE_IN_2_38
+gchar *
+g_utf8_strescape      (const gchar *source,
+                       const gchar *exceptions);
+
 /* Find the UTF-8 character corresponding to ch, in string p. These
    functions are equivalants to strchr and strrchr */
 GLIB_AVAILABLE_IN_ALL
diff --git a/glib/gutf8.c b/glib/gutf8.c
index 9244fe8..14e50fb 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -437,6 +437,65 @@ g_utf8_strncpy (gchar       *dest,
   return dest;
 }
 
+/**
+ * g_utf8_strescape:
+ * @source: a string to escape
+ * @exceptions: a string of characters not to escape in source
+ *
+ * Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\' and '"' in
+ * the string source by inserting a '\' before them. Characters supplied in
+ * exceptions are not escaped.
+ * Unlike g_strescape() UTF-8 characters are preseved.
+ *
+ * Return value: a newly-allocated copy of @source with certain characters
+ *   escaped. See above.
+ *
+ * Since: 2.24
+ **/
+gchar *
+g_utf8_strescape (const gchar *source,
+                  const gchar *exceptions)
+{
+  GString *result = g_string_new (NULL);
+
+  while (TRUE)
+    {
+      gchar c = *source++;
+
+      switch (c)
+        {
+        case '\0':
+          goto done;
+        case '\n':
+          g_string_append (result, "\\n");
+          break;
+        case '\"':
+          g_string_append (result, "\\\"");
+          break;
+        case '\\':
+          g_string_append (result, "\\\\");
+          break;
+        case '\b':
+          g_string_append (result, "\\b");
+          break;
+        case '\f':
+          g_string_append (result, "\\f");
+          break;
+        case '\r':
+          g_string_append (result, "\\r");
+          break;
+        case '\t':
+          g_string_append (result, "\\t");
+          break;
+        default:
+          g_string_append_c (result, c);
+        }
+    }
+
+ done:
+  return g_string_free (result, FALSE);
+}
+
 /* unicode_strchr */
 
 /**
