From 9410a5e982d6f2e8a2cc611088a110d73eb1a5fc Mon Sep 17 00:00:00 2001 From: bdieterm <119257544+bdieterm@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:04:40 +0100 Subject: [PATCH] Gui: use utf-8 encoding for saving recorded macros FCMacros always have the header "# -*- coding: utf-8 -*". But the QTextStream class in Qt5 does not always use utf-8 for saving the text file. --- src/Gui/Macro.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Gui/Macro.cpp b/src/Gui/Macro.cpp index 7b6ca92005..32549ca763 100644 --- a/src/Gui/Macro.cpp +++ b/src/Gui/Macro.cpp @@ -80,6 +80,9 @@ bool MacroFile::commit() // sort import lines and avoid duplicates QTextStream str(&file); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + str.setCodec("UTF-8"); +#endif QStringList import; import << QString::fromLatin1("import FreeCAD"); QStringList body;