GNOME Bugzilla – Bug 621907
Zenity should ignore markup with a flag
Last modified: 2011-09-24 23:03:00 UTC
this report has been filed here: https://bugs.edge.launchpad.net/ubuntu/+source/zenity/+bug/387536 "Zenity (specifically, the --info mode) should have a flag that will cause it to ignore Pango markup in its input. I frequently want to use Zenity to display output from scripts, and I shouldn't have to worry about whether the text has things like ampersands in it. (This is particularly annoying, because instead of failing to run when given incorrect input, Zenity will silently default to "All updates are complete", but that's another bug.) I know that I can pipe into zenity --text-info, but that's a workaround, and I don't particularly want to confuse the user by presenting them with a text entry dialog when I just want to display some status information. Some sort of --ignore-pango flag for Zenity would be great." " Any text with an ampersand will trigger the bug. $ zenity --info --text 'This has an & in it' The following is printed to stderr: (zenity:21569): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 1: Character ' ' is not valid at the start of an entity name; the & character begins an entity; if this ampersand isn't supposed to be an entity, escape it as & And zenity displays its default "All updates are complete" dialog instead of the text. Ideally, it should be told to ignore Pango markup. Failing that, the man page should explicitly inform users that they need to escape anything that could be interpreted as Pango markup. " Thanks,
I'm suffering from something like this, too. my_warn() { echo "error: $@" zenity --error --text="$@" } my_warn 'c:\windows\system32 does not exist' yields surprising results: on the console, one sees what one expects, but in the zenity window, one sees c:windowssystem32 with no backslashes. A workaround is to double the backslashes: my_warn() { echo "error: $@" zenity --error --text="`echo $@ | sed 's,\\\\,\\\\\\\\,g'`" } Maybe this is a doc bug, if nothing else?
Sound's good, I'll work on the patch for this. I believe only the error, info, question and warning is affected by this.
Patch applied on master. Now the error, info, question and warning dialog has an option --no-markup. zenity --info --no-markup --text 'This has an & in it' and zenity --error --no-markup --text 'c:\windows\system32 does not exist' is working.
Is this really fixed in 2.30?
No, you right, it's fixed on 3.x