Skip to content

Commit

Permalink
Fix GH#16363: Accidentals in chord symbols rendered incorrectly when …
Browse files Browse the repository at this point in the history
…using custom XML file
  • Loading branch information
Jojo-Schmitz committed Apr 23, 2024
1 parent 8526264 commit 9e939b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/engraving/dom/chordlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,10 @@ void ChordList::read(XmlReader& e)
String code = e.attribute("code");
String symClass = e.attribute("class");
if (!code.empty()) {
if (!code.startsWith(u"0x") && !code.startsWith(u"0") && !code.startsWith('&') && !code.endsWith(';')) {
// fix broken chord lists, see https://github.com/musescore/MuseScore/issues/16363
code = u"0x" + code;
}
bool ok = true;
char32_t val = code.toUInt(&ok, 0);
if (!ok) {
Expand Down Expand Up @@ -1780,7 +1784,8 @@ void ChordList::write(XmlWriter& xml) const
if (s.code.isNull()) {
xml.tag("sym", { { "name", s.name }, { "value", s.value } });
} else {
xml.tag("sym", { { "name", s.name }, { "code", String::number(s.code.unicode(), 16) } });
// write hex numbers with a "0x" prefix, so they can convert back properly on read
xml.tag("sym", { { "name", s.name }, { "code", u"0x" + String::number(s.code.unicode(), 16) } });
}
}
}
Expand Down

0 comments on commit 9e939b2

Please sign in to comment.