Skip to content

Commit

Permalink
fix #41870 force UTF-8 encoding for prj files
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik authored and nyalldawson committed Oct 5, 2021
1 parent cd1bf9b commit 0150ab8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/plugins/grassprovider/Grass7Utils.py
Expand Up @@ -91,7 +91,7 @@ def exportCrsWktToFile(crs):
"""
wkt = crs.toWkt(QgsCoordinateReferenceSystem.WKT_PREFERRED)
wkt_file = QgsProcessingUtils.generateTempFilename('crs.prj')
with open(wkt_file, 'wt') as f:
with open(wkt_file, 'wt', encoding='utf-8') as f:
f.write(wkt)
return wkt_file

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/extractprojection.py
Expand Up @@ -110,7 +110,7 @@ def processAlgorithm(self, parameters, context, feedback):
crs = tmp.ExportToWkt()
tmp = None

with open(outFileName + '.prj', 'wt') as prj:
with open(outFileName + '.prj', 'wt', encoding='utf-8') as prj:
prj.write(crs)
results[self.PRJ_FILE] = outFileName + '.prj'
else:
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/DefineProjection.py
Expand Up @@ -85,7 +85,7 @@ def processAlgorithm(self, parameters, context, feedback):
dsPath = dsPath[:-4]

wkt = crs.toWkt(QgsCoordinateReferenceSystem.WKT1_ESRI)
with open(dsPath + '.prj', 'w') as f:
with open(dsPath + '.prj', 'wt', encoding='utf-8') as f:
f.write(wkt)

qpjFile = dsPath + '.qpj'
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sagaprovider/SagaAlgorithm.py
Expand Up @@ -348,7 +348,7 @@ def processAlgorithm(self, parameters, context, feedback):
if crs is not None:
for out in output_layers:
prjFile = os.path.splitext(out)[0] + '.prj'
with open(prjFile, 'w') as f:
with open(prjFile, 'wt', encoding='utf-8') as f:
f.write(crs.toWkt())

for old, new in output_files_nonascii.items():
Expand Down

0 comments on commit 0150ab8

Please sign in to comment.