Instrument name with & doesn't save as & if edited by double-click, causing unopenable file
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!).
Comments
forgot to attach the score?
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 &.
Reproduced. Doesn't happen if you change the Long/Short Instrument Name via right-click/Staff Properties.
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
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
I think this is a better title (maybe not the best title).
I did identify it as a 2.1-dev issue.
@mike320, I apologise.
Same issue in master
Seems the editing Feature got introduced by https://github.com/musescore/MuseScore/commit/e9e39d1d2
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.
Regarding the editing feature, I think we should keep it. We just need to make sure to save properly.
Right, I didn't intend to imply ist removal.
Check https://github.com/musescore/MuseScore/commit/e9e39d1d2#diff-1376212765…, I believe this is the culprit
I'll fix this.
https://github.com/musescore/MuseScore/pull/3078
Fixed in branch master, commit 9343b8ed2c
fix #181811 validate instrument text name after editing
Fixed in branch master, commit c351a0e9ee
Merge pull request #3078 from ericfont/181811-ValidateInstName
fix #181811 validate instrument text name after editing
needed in 2.1 too
Fixed in branch 2.1, commit d6a9689b20
fix #181811 validate instrument text name after editing
Automatically closed -- issue fixed for 2 weeks with no activity.