Instrument name with & doesn't save as & if edited by double-click, causing unopenable file

• Mar 16, 2017 - 13:17
Reported version
S2 - Critical

When double click an instrument name to edit it, it will cause the file to become corrupted and MS will refuse to open it if you include an & sign in the name. This is because MS keeps this as "&" rather than rewriting it as "&" as is required by the program. Line 174 in the attached files shows the corrupt mscx file that refused to open for me. I was able to fix it and salvage my work (WHEW!).

name corrupted.png


Do I really need to attach a score? I explained how to make reproduce it and showed you a picture from my XML editor what the problem looks like. And that particular score is no longer corrupted because I fixed it.

I found the error that leads to corruption in build 30238c6. I discovered the error because I changed to build 858a105. When I try it in this build, the long instrument name is truncated before the & when you press escape. If you save and reopen it, it displays the name correctly. This is not a critical problem (like a file an average user can't open), but it is still a problem. I don't know if any changes were made to this feature between the two builds that changed the behavior or if it is a bug that will act differently in different circumstances. In either case it needs to be fixed.

BTW, when I wrote the original report and wrote out & a m p ; with no spaces and the forum rewrote is as &.

Reported version 2.2 2.1

Here is a file that I belives reproduces the issue: Title.mscx

I created that file by saving My_First_Score as a .mscx, and then editing the .mscx in a text editor, and removed the a m p ; from the & element in the inst text. When I import into 2.0.3 I get a popup error messaging saying:

"XML read error at line 78 column 26"

Which seems like the proper thing that the XML parser should do when it doesn't understand the & code by itself without the a m p ;... So I'm not sure this is an actual bug (if I understand the issue correctly).

Is that the actual issue? Is there a way to produce this issue from inside musescore or do I have to use an external editor?

Just double-click an Instrument Name in 2.1 to edit it (2.0.3 doesn't have that feature), and insert an &. Exit editmode and the & and everything after it disappears. Save, close, reopen. Result: score is corrupt

Reported version 2.1 2.2

Well I should clarify. Both 2.0.3 and 2.1 aren't able to read a .mscx with instrument text that has the & without the a m p ;. But in 2.0.3 it is not possible via the GUI to change the instrument text by double-clicking. This should really be labeled as a 2.1-dev issue because I can reproduce on 13d7332

Title Double click and rename causes corrupt file XML Save Instrument Text with & needs to convert to a m p ;

I think this is a better title (maybe not the best title).

Title XML Save Instrument Text with & needs to convert to & Instrument name with & doesn't save as & if edited by double-click, causing unopenable file

This should be fairly easy to fix...just a matter of sending the instrument title string through one of the QT processing functions to convert to xml-friendly string. I believe this is done for other strings, so could simply do the same thing...just need to find that function in the code.