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 26, 2025
1 parent 535b548 commit ab54c3b
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 @@ -3819,6 +3819,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 @@ -3857,6 +3861,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 ab54c3b

Please sign in to comment.