Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse tooltip files as utf-8 encoded #35

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion gcodeworkshop/src/gcoderdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <QVariant> // for QVariant
#include <QWidget> // for QWidget
#include <Qt> // for CaseInsensitive, CaseSensitive, CaseSensitivity, WA_DeleteOnClose, Custo...
#include <QtGlobal> // for QFlags, QFlags<>::enum_type, qDebug
#include <QtGlobal> // for QFlags, QFlags<>::enum_type, qDebug, QT_VERSION, QT_VERSION_CHECK

class QMenu;

Expand Down Expand Up @@ -639,7 +639,14 @@ void GCoderDocument::loadToolTips(QHash<QString, QString>& tips, const QString&
{
if (QFile::exists(fileName)) {
QSettings settings(fileName, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Qt5: By default QSettings will accept Latin-1 encoded INI files,
// where non-ASCII values are encoded using standard INI escape sequences.
// Qt6: QSettings will assume that values in the INI file are utf-8 encoded.
settings.setIniCodec("utf-8");
#endif
settings.beginGroup(group);

const QStringList& keys = settings.childKeys();

for (const QString& k : keys) {
Expand Down
Loading