After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 621907 - Zenity should ignore markup with a flag
Zenity should ignore markup with a flag
Status: RESOLVED FIXED
Product: zenity
Classification: Core
Component: general
3.0.x
Other Linux
: Normal enhancement
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-06-17 16:44 UTC by Pedro Villavicencio
Modified: 2011-09-24 23:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.29/2.30



Description Pedro Villavicencio 2010-06-17 16:44:23 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,
Comment 1 Dan Kegel 2011-02-25 04:40:50 UTC
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?
Comment 2 Arx Cruz 2011-07-06 14:49:07 UTC
Sound's good, I'll work on the patch for this.
I believe only the error, info, question and warning is affected by this.
Comment 3 Arx Cruz 2011-07-06 18:12:47 UTC
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.
Comment 4 Andreas Köhler 2011-09-20 13:00:08 UTC
Is this really fixed in 2.30?
Comment 5 Arx Cruz 2011-09-24 23:03:00 UTC
No, you right, it's fixed on 3.x