From 5113802daf38afdf5934fcd210e74513b22decd8 Mon Sep 17 00:00:00 2001 From: xavi-b Date: Tue, 20 Sep 2022 00:21:11 +0200 Subject: [PATCH] Fix MacOS UTF-8 normalization issue Signed-off-by: xavi-b --- src/common/syncjournaldb.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index fed825794a336..23e33c16999c3 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -882,10 +882,15 @@ QVector SyncJournalDb::tableColumns(const QByteArray &table) qint64 SyncJournalDb::getPHash(const QByteArray &file) { + QByteArray bytes = file; +#ifdef Q_OS_MAC + bytes = QString::fromUtf8(file).normalized(QString::NormalizationForm_C).toUtf8(); +#endif + qint64 h = 0; - int len = file.length(); + int len = bytes.length(); - h = c_jhash64((uint8_t *)file.data(), len, 0); + h = c_jhash64((uint8_t *)bytes.data(), len, 0); return h; }