Skip to content

Commit e165451

Browse files
committed
qt/tonalutils: Add support for parsing lower value "reserved" Tonal digits (0-8)
1 parent d05c796 commit e165451

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/qt/tonalutils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool TonalUtils::Supported()
3838
return false;
3939
}
4040

41-
#define RE_TONAL_DIGIT "[\\d\\xe8e9-\\xe8ef\\xe9d9-\\xe9df]"
41+
#define RE_TONAL_DIGIT "[\\d\\xe8e0-\\xe8ef\\xe9d0-\\xe9df]"
4242
static QRegExpValidator tv(QRegExp("-?(?:" RE_TONAL_DIGIT "+\\.?|" RE_TONAL_DIGIT "*\\." RE_TONAL_DIGIT "*)"), nullptr);
4343

4444
QValidator::State TonalUtils::validate(QString&input, int&pos)
@@ -67,15 +67,15 @@ void TonalUtils::ConvertToHex(QString&str)
6767
for (int i = 0; i < str.size(); ++i)
6868
{
6969
ushort c = str[i].unicode();
70-
if (c == 0xe9d9 || c == 0xe8e9) {
71-
str[i] = '9';
72-
}
73-
else
7470
if (c == '9')
7571
str[i] = 'a';
7672
else
77-
if (c >= 0xe8ea && c <= 0xe8ef) {
73+
if (c >= 0xe8e0 && c <= 0xe8e9) { // UCSUR 0-9
74+
str[i] = c - (0xe8e0 - '0');
75+
} else if (c >= 0xe8ea && c <= 0xe8ef) { // UCSUR a-f
7876
str[i] = c - (0xe8ea - 'a');
77+
} else if (c >= 0xe9d0 && c <= 0xe9d9) {
78+
str[i] = c - (0xe9d0 - '0');
7979
} else
8080
if (c >= 0xe9da && c <= 0xe9df)
8181
str[i] = c - 0xe999;

0 commit comments

Comments
 (0)