From 517e82ea651be48264937613b560509bcc1e07e2 Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Tue, 25 Feb 2025 10:17:14 +0000 Subject: [PATCH] explicitly set UTF-8 encoding when reading/writing color palettes (fix #60740) --- src/core/symbology/qgssymbollayerutils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/symbology/qgssymbollayerutils.cpp b/src/core/symbology/qgssymbollayerutils.cpp index 91dee5189e5f..3c18bdd3aac1 100644 --- a/src/core/symbology/qgssymbollayerutils.cpp +++ b/src/core/symbology/qgssymbollayerutils.cpp @@ -3826,6 +3826,10 @@ bool QgsSymbolLayerUtils::saveColorsToGpl( QFile &file, const QString &paletteNa } QTextStream stream( &file ); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + stream.setCodec( "UTF-8" ); +#endif + stream << "GIMP Palette" << Qt::endl; if ( paletteName.isEmpty() ) { @@ -3864,6 +3868,9 @@ QgsNamedColorList QgsSymbolLayerUtils::importColorsFromGpl( QFile &file, bool &o } QTextStream in( &file ); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + in.setCodec( "UTF-8" ); +#endif QString line = in.readLine(); if ( !line.startsWith( QLatin1String( "GIMP Palette" ) ) )