Skip to content

Commit

Permalink
[processing] correctly write html output in utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jan 8, 2016
1 parent acf7493 commit 8d2f7bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Expand Up @@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import math
import codecs

from qgis.core import QgsStatisticalSummary
from processing.core.GeoAlgorithm import GeoAlgorithm
Expand Down Expand Up @@ -178,7 +179,11 @@ def processAlgorithm(self, progress):
self.setOutputValue(self.IQR, iqr)

def createHTML(self, outputFile, algData):
f = open(outputFile, 'w')
f = codecs.open(outputFile, 'w', encoding='utf-8')
f.write('<html><head>')
f.write('<meta http-equiv="Content-Type" content="text/html; \
charset=utf-8" /></head><body>')
for s in algData:
f.write('<p>' + unicode(s) + '</p>')
f.write('</body></html>')
f.close()
Expand Up @@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import math
import codecs
from qgis.core import QgsFeatureRequest, QgsFeature, QgsDistanceArea
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterVector
Expand Down Expand Up @@ -115,7 +116,11 @@ def processAlgorithm(self, progress):
self.setOutputValue(self.Z_SCORE, float(data[4].split(': ')[1]))

def createHTML(self, outputFile, algData):
f = open(outputFile, 'w')
f = codecs.open(outputFile, 'w', encoding='utf-8')
f.write('<html><head>')
f.write('<meta http-equiv="Content-Type" content="text/html; \
charset=utf-8" /></head><body>')
for s in algData:
f.write('<p>' + unicode(s) + '</p>')
f.write('</body></html>')
f.close()
7 changes: 6 additions & 1 deletion python/plugins/processing/algs/qgis/RasterLayerStatistics.py
Expand Up @@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import math
import codecs

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterRaster
Expand Down Expand Up @@ -114,7 +115,11 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.STD_DEV, self.tr('Standard deviation')))

def createHTML(self, outputFile, algData):
f = open(outputFile, 'w')
f = codecs.open(outputFile, 'w', encoding='utf-8')
f.write('<html><head>')
f.write('<meta http-equiv="Content-Type" content="text/html; \
charset=utf-8" /></head><body>')
for s in algData:
f.write('<p>' + unicode(s) + '</p>')
f.write('</body></html>')
f.close()

0 comments on commit 8d2f7bb

Please sign in to comment.