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 396311 - & in attributes in .glade files load as & instead of &
& in attributes in .glade files load as & instead of &
Status: RESOLVED FIXED
Product: glade
Classification: Applications
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-14 03:02 UTC by Jonas Berlin (xkr47)
Modified: 2007-01-21 06:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes the problem (649 bytes, patch)
2007-01-14 03:04 UTC, Jonas Berlin (xkr47)
none Details | Review
Fixes the problem, second attempt (1.54 KB, patch)
2007-01-14 10:43 UTC, Jonas Berlin (xkr47)
none Details | Review

Description Jonas Berlin (xkr47) 2007-01-14 03:02:05 UTC
Please describe the problem:
libxml2 returns & in attributes as & instead of &



Steps to reproduce:
1. Make a button whose "Name" attribute contains a & - OR - put a & in "Comments for translators"
2. Click save
3. Notice how saved .glade file is ok
4. Load the file

Actual results:
& has changed to & in the gui

Expected results:
& should remain & after load

Does this happen every time?
yes

Other information:
This is NOT a duplicate of Bug #360586. That bug is related to saving, this is related to loading.

The actual problem is in the usage of the sax parser in the libxml2 library, and it has been reported as a bug multiple times, for example Bug #172638. There you see it's actually expected to behaviour, which can be changed to work as glade wants it simply by calling xmlSubstituteEntitiesDefault(1); before starting the sax parsing.

I have tested this and it works fine. I'll attach a patch which simply adds the abovementioned call to the two places where the sax parsing occurs.
Comment 1 Jonas Berlin (xkr47) 2007-01-14 03:04:02 UTC
Created attachment 80215 [details] [review]
Fixes the problem
Comment 2 Jonas Berlin (xkr47) 2007-01-14 10:43:07 UTC
Created attachment 80226 [details] [review]
Fixes the problem, second attempt

After sleeping overnight, I realized the same problem exists in libglade as well so I filed bug #396372 as well. While making a patch for libglade I also realized that my patch didn't restore the original state and thus if glade3 or some glade3 plugin would use libxml2 for anything else, the behaviour would be different.

So, I attached a new patch which restores the original state afterwards. I have tested it to work just as well as the old one.
Comment 3 Tristan Van Berkom 2007-01-21 06:18:02 UTC
Ok thanks I'm committing this.

Please in the future generate your patch with 'diff -up'
(the -p option makes it easier to review).

If you want to comment on this bug with your name, I'll 
put it in the ChangeLog.