xfce_dialog_show_error() does not show strings containing ampersand chars: Gtk-WARNING **: Failed to set text '<span weight='bold' size='large'>Failed to open the URL 'news:?xt=13415&amv'</span>' from markup due to error parsing markup: Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as & The solution would be either to replace ampersand with "&" within xfce_dialog_show_error(), or the caller should do this. The problem with the second option is that C library does not provide a function to replace string char(s) with other chars; so please consider the first option.
Patches welcome :)
Created attachment 7458 Escape the text before showing it
Skunnyk, please see attached :)
Hm, I can't reproduce the bug (without the patch): xfce_dialog_show_error (NULL, NULL, _("Hey, I'm a & ! ")); It's correctly displayed (tried inside xfburn context). Or maybe it's in another context (markup ?)
The problem is still there for me with the current git version and the URL shown above: "news:?xt=13415&amv". However, I couldn't reproduce it with the version 4.12.2 which my Ubuntu system has; so please make sure you're testing it against correct version.
Thanks to ochosi, we can use the tests/ inside libxfce4ui to test the behavior (compile with --enable-tests) I confirm the bug with ./test-ui-gtk3 version, and your patch fix the bug. However, this break ./test-ui-gtk2 version, where & are transformed to & . Maybe add a #if / #else to support gtk2 and gtk3 ? The problem is also present in xfce_dialog_show_warning, xfce_dialog_show_info, xfce_dialog_show_info , so create a more generic solution ?
Or fix it directly inside xfce_message_dialog as all xfce_dialog_show_* use this function
Created attachment 7460 Fix xfce_dialog_message Proposal to fix xfce_dialog_message for special characters in gtk3 version.
Created attachment 7461 fix xfce_message_dialog_new_valist Better fix ! Fix it directly in xfce_message_dialog_new_valist
The patch is almost good, expect for instead of + gchar *escaped_text; + /* escape ampersand symbols, etc. (bug #12715) */ + escaped_text = g_markup_escape_text (primary_text, -1); it's better to write + /* escape ampersand symbols, etc. (bug #12715) */ + gchar *escaped_text = g_markup_escape_text (primary_text, -1); in order to avoid "mixed declarations and code" warning. The patch does not address the case when the text has already been escaped by the caller - in this case, something like "news:?xt=13415&amv" will be shown in the dialog. However, I'm not sure whether this can be addressed at all; and in any case, this is much better than not showing any dialog at all, like it happens now.
Thank you for the review. I looked in the code for g_markup_escape_text (https://github.com/search?p=1&q=org%3Axfce-mirror+g_markup_escape_text&type=Code), and apart from xfce4-terminal, there is no use of g_markup_escape_text with xfce_dialog-show_*, so the problem should not appear :)
OK, it seems I can use LIBXFCE4UI_CHECK_VERSION() to only escape text when libxfce4ui does not do it. How about merging the patch then?
Romain B referenced this bugreport in commit 8c99d266d7a9b0b09b1dc52df9c5bca2e812247c Allows to properly show some characters, such as ampersand. https://git.xfce.org/xfce/libxfce4ui/commit?id=8c99d266d7a9b0b09b1dc52df9c5bca2e812247c
Et voilà :)
Thank you! The status should become "fixed" now, right?
Done
Rha, stupid bz.
Igor referenced this bugreport in commit c563e646de402d628bee2de85aa5de9fea56f36d Do not escape URL as libxfce4ui now does it https://git.xfce.org/apps/xfce4-terminal/commit?id=c563e646de402d628bee2de85aa5de9fea56f36d