Skip to content

Commit

Permalink
explicitly set UTF-8 encoding when reading/writing color palettes (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy authored and nyalldawson committed Feb 25, 2025
1 parent b39cc8f commit 422b2e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/symbology/qgssymbollayerutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
{
Expand Down Expand Up @@ -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" ) ) )
Expand Down

0 comments on commit 422b2e0

Please sign in to comment.