Trouble with an ampersand in a string passed to yad

245 views
Skip to first unread message

Joe

unread,
Jun 20, 2013, 6:57:06 PM6/20/13
to yad-c...@googlegroups.com
I got a couple of  weird named files from my bank that include ampersands in the names.

My scripts seem to handle it fine until it gets into yad for displaying it to the user.

These are "production" scripts that I use many times a day and I have been refining them for years. It's not new code.

Even though this one display is wrong, the rest of the script runs perfectly.

Please take a look at this and see if you can tell if it's a bug in my code or in yad.

TIA

Joe - very appreciative yad user
yad version 0.21.0-1~webupd8~precise (from the ppa)
running on kubuntu precise 64 bit

----

My yad dialog shows up, but its content is all blank.

This is my "Print Preview" dialog. When I select OK, the rest of the script works fine - including several other calls to yad. The code is:

## Preview Print Queue
##\( -iname "*.txt" ! -iname ".*" \)
CHOICES="$(find . -maxdepth 1 -type f ! -name '\.*' -printf '"%f"\n' | sort)"
##echo "CHOICES [${CHOICES}]"
CHOICES="$(echo ${CHOICES} | sed -r -e 's/\n/\" /')"
##echo "CHOICES [${CHOICES}]"
yad --title "  Preview Print Queue  " --on-top --tail \
--text="     Select ${YYES} to Continue\n\nSelect ${YNO} to Skip Printing\n\n$(eval mprb -i ${CHOICES})" \
--width=400 --height=500 --question
if [ "$?" -ne 0 ]
then
  RC=0
  quit
fi

The whole thing is at: https://sourceforge.net/projects/duplexpr/

Here's what shows up with debugging turned on (just the snip of that portion where the error  occurs):

+ yad --title '  Preview Print Queue  ' --on-top --tail '--text=     Select OK to Continue\n\nSelect Cancel to Skip Printing\n\nPrinting 1 of 5 - [01] - 2 pages
Printing 2 of 5 - [02] - 2 pages
Printing 3 of 5 - [agreement_consent_electronic_disclosures.pdf] - 5 pages
Printing 4 of 5 - [Pollock+-+address+change+form+&+atm+card+application+&+agreement.pdf] - 6 pages
Printing 5 of 5 - [Pollock+-+signature+card+&+disclosure.pdf] - 10 pages

Printing 5 jobs with 25 pages
    13 Sheets per pass' --width=400 --height=500 --question

(yad:10435): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 8: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as &

(yad:10435): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: Error on line 8: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as &

Victor Ananjevsky

unread,
Jun 21, 2013, 5:09:20 AM6/21/13
to yad-c...@googlegroups.com
В Thu, 20 Jun 2013 15:57:06 -0700 (PDT)
Joe <jos...@main.nc.us> писал:
> --
> You received this message because you are subscribed to the Google Groups "yad-common" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

you must replace all ampersands on '&amp;' sequence, for example by piping text through sed "s/\&/\&amp;/g"
or pass --no-markup option to yad


--
Victor Ananjevsky <anan...@gmail.com>

Joe Consultant

unread,
Jun 22, 2013, 10:43:21 AM6/22/13
to yad-common
Thanks. I'm fixing my scripts.



--
You received this message because you are subscribed to a topic in the Google Groups "yad-common" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/yad-common/j-AWQMwNtN0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to yad-common+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages