GNOME Bugzilla – Bug 360586
& in a label with markup enable saves as an &
Last modified: 2011-10-12 08:36:10 UTC
Please describe the problem: When saving a glade file with a label containing the following text <span weight="bold" size="x-small">&</span>, the saved result is <span weight="bold" size="x-small">&</span> Steps to reproduce: 1. Create a Label 2. Set text to <span weight="bold" size="x-small">&</span> 3. Toggle "Use Markup" button 4. Save glade file 5. Load glade file 6. View Label text 7. Notice how label text is now <span weight="bold" size="x-small">&</span> Actual results: The label contains <span weight="bold" size="x-small">&</span> Expected results: The label should contain <span weight="bold" size="x-small">&</span> Does this happen every time? Yes Other information:
Created attachment 75885 [details] [review] Simple patch hmm, well this patch escape every string before saving it to the xml file.
aplyed in cvs
I just checked the CVS version, and this patch was not applied to CVS even though it does solve hte problem I described above
Will, sorry the report was not so clear, this fix was actually applied to the stable branch (glade3-3-0-branch), I have another fresh patch against the stable branch and I plan to make one final 3.0 release, that should be in the next couple of days. At that point I will merge in the remaining 'stable' development into HEAD and completely drop 'stable' (hopefully :D )
This bug needs to be reopened. An additional problem was discovered as follows: Description: Set the property “Use Markup” to “yes” on a label and the “&” still can’t be set on label. The warning: (alp-glade:31685): Gtk-WARNING **: Failed to set label 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 & I am unable to reopen this bug, due to lack of priveleges. I am posting this comment in hopes that some with proper proveleges will reopen it for me.
reopening bug.
that patch had been committed a long time ago, just triaging it.
Thankfully this was finally fixed properly in bug 654609. The thing about the use markup property is that you are going to have to manually escape the label text in any case. The label text is the text that is going to be applied to the widget, if the widget has use markup, then the text needs to be escaped for xml special chars.