From 39deaff54176ffad76831c9275afc837fa079eaf Mon Sep 17 00:00:00 2001 From: Igor Date: Tue, 28 Nov 2017 10:37:10 -0500 Subject: [PATCH] Escape the text before showing it This allows to properly show some characters, such as ampersand. Fixes bug #12715 --- libxfce4ui/xfce-dialogs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libxfce4ui/xfce-dialogs.c b/libxfce4ui/xfce-dialogs.c index cf402f9..d69e74a 100644 --- a/libxfce4ui/xfce-dialogs.c +++ b/libxfce4ui/xfce-dialogs.c @@ -423,7 +423,7 @@ xfce_dialog_show_error (GtkWindow *parent, ...) { va_list args; - gchar *primary_text; + gchar *primary_text, *escaped_text; g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent)); @@ -431,13 +431,17 @@ xfce_dialog_show_error (GtkWindow *parent, primary_text = g_strdup_vprintf (primary_format, args); va_end (args); + /* escape ampersand symbols, etc. (bug #12715) */ + escaped_text = g_markup_escape_text (primary_text, -1); + g_free (primary_text); + xfce_message_dialog (parent, _("Error"), #if !GTK_CHECK_VERSION (3, 10, 0) GTK_STOCK_DIALOG_ERROR, #else "dialog-error", #endif - primary_text, error ? error->message : NULL, + escaped_text, error ? error->message : NULL, #if !GTK_CHECK_VERSION (3, 10, 0) GTK_STOCK_CLOSE, #else @@ -445,7 +449,7 @@ xfce_dialog_show_error (GtkWindow *parent, #endif GTK_RESPONSE_CLOSE, NULL); - g_free (primary_text); + g_free (escaped_text); } -- 2.15.0