Skip to content

Commit 17cad0a

Browse files
committed
fix: hotcue comments are utf-16be, regression from mixxxdj#13293
Fixes mixxxdj#14789
1 parent 19cd401 commit 17cad0a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/library/rekordbox/rekordboxfeature.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ inline bool instanceof (const T* ptr) {
255255
return dynamic_cast<const Base*>(ptr) != nullptr;
256256
}
257257

258-
QString toUnicode(const std::string& toConvert) {
259-
return QTextCodec::codecForName("UTF-16LE")
258+
QString toUnicode(const std::string& toConvert, const char* src_encoding) {
259+
return QTextCodec::codecForName(src_encoding)
260260
->toUnicode(toConvert.data(), static_cast<int>(toConvert.length()));
261261
}
262262

@@ -278,7 +278,7 @@ QString getText(rekordbox_pdb_t::device_sql_string_t* deviceString) {
278278
} else if (instanceof <rekordbox_pdb_t::device_sql_long_utf16le_t>(deviceString->body())) {
279279
rekordbox_pdb_t::device_sql_long_utf16le_t* longUtf16leString =
280280
static_cast<rekordbox_pdb_t::device_sql_long_utf16le_t*>(deviceString->body());
281-
text = toUnicode(longUtf16leString->text());
281+
text = toUnicode(longUtf16leString->text(), "UTF-16LE");
282282
}
283283

284284
// Some strings read from Rekordbox *.PDB files contain random null characters
@@ -997,7 +997,7 @@ void readAnalyze(TrackPointer track,
997997
memory_cue_loop_t memoryCue;
998998
memoryCue.startPosition = position;
999999
memoryCue.endPosition = mixxx::audio::kInvalidFramePos;
1000-
memoryCue.comment = toUnicode(cueExtendedEntry->comment());
1000+
memoryCue.comment = toUnicode(cueExtendedEntry->comment(), "UTF-16BE");
10011001
memoryCue.color = colorFromID(static_cast<int>(
10021002
cueExtendedEntry->color_id()));
10031003
memoryCuesAndLoops << memoryCue;
@@ -1016,7 +1016,7 @@ void readAnalyze(TrackPointer track,
10161016
loop.startPosition = position;
10171017
loop.endPosition = mixxx::audio::FramePos(
10181018
sampleRateKhz * static_cast<double>(endTime));
1019-
loop.comment = toUnicode(cueExtendedEntry->comment());
1019+
loop.comment = toUnicode(cueExtendedEntry->comment(), "UTF-16BE");
10201020
loop.color = colorFromID(static_cast<int>(cueExtendedEntry->color_id()));
10211021
memoryCuesAndLoops << loop;
10221022
} break;
@@ -1031,14 +1031,14 @@ void readAnalyze(TrackPointer track,
10311031
position,
10321032
mixxx::audio::kInvalidFramePos,
10331033
hotCueIndex,
1034-
toUnicode(cueExtendedEntry->comment()),
1034+
toUnicode(cueExtendedEntry->comment(), "UTF-16BE"),
10351035
mixxx::RgbColor(qRgb(
10361036
static_cast<int>(
10371037
cueExtendedEntry->color_red()),
10381038
static_cast<int>(
10391039
cueExtendedEntry->color_green()),
10401040
static_cast<int>(cueExtendedEntry
1041-
->color_blue()))));
1041+
->color_blue()))));
10421042
} break;
10431043
}
10441044
}

0 commit comments

Comments
 (0)