Skip to content

Commit d04239d

Browse files
committed
[processing] small fix for non-ascii string (fixes #9175)
1 parent 1bca310 commit d04239d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

python/plugins/processing/gui/ScriptEditorDialog.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
__revision__ = '$Format:%H$'
2727

2828
import pickle
29+
import codecs
30+
import sys
2931

3032
from PyQt4.QtCore import *
3133
from PyQt4.QtGui import *
@@ -152,12 +154,11 @@ def saveScript(self, saveAs):
152154
if self.alg is not None:
153155
self.alg.script = text
154156
try:
155-
fout = open(self.filename, 'w')
156-
fout.write(text)
157-
fout.close()
157+
with codecs.open(self.filename, 'w', encoding='utf-8') as fout:
158+
fout.write(text)
158159
except IOError:
159160
QMessageBox.warning(self, self.tr('I/O error'),
160-
self.tr('Unable to save edits. Reason:\n %1')
161+
self.tr('Unable to save edits. Reason:\n %s')
161162
% unicode(sys.exc_info()[1]))
162163
return
163164
self.update = True

python/plugins/processing/script/ScriptAlgorithm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def processAlgorithm(self, progress):
254254
out.setValue(ns[out.name])
255255

256256
def helpFile(self):
257-
helpfile = unicode(self.descriptionFile) + '.help'
257+
helpfile = self.descriptionFile + '.help'
258258
if os.path.exists(helpfile):
259259
h2h = Help2Html()
260260
return h2h.getHtmlFile(self, helpfile)

0 commit comments

Comments
 (0)