Skip to content

Commit

Permalink
[pyqgis-console] more encoding fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Aug 9, 2013
1 parent d61cb25 commit 577a72b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/console/console_editor.py
Expand Up @@ -576,7 +576,7 @@ def runScriptCode(self):
tmpFile = self.createTempFile()
filename = tmpFile

self.parent.pc.shell.runCommand("execfile(r'{0}')".format(filename))
self.parent.pc.shell.runCommand(u"execfile(r'{0}')".format(filename))

def runSelectedCode(self):
cmd = self.selectedText()
Expand Down
7 changes: 4 additions & 3 deletions python/console/console_sci.py
Expand Up @@ -29,6 +29,7 @@
import sys
import os
import code
import codecs

from qgis.core import QgsApplication
from ui_console_history_dlg import Ui_HistoryDialogPythonConsole
Expand Down Expand Up @@ -277,7 +278,7 @@ def updateHistory(self, command):
def writeHistoryFile(self, fromCloseConsole=False):
ok = False
try:
wH = open(_historyFile, 'w')
wH = codecs.open(_historyFile, 'w', encoding='utf-8')
for s in self.history:
wH.write(s + '\n')
ok = True
Expand All @@ -292,7 +293,7 @@ def writeHistoryFile(self, fromCloseConsole=False):
def readHistoryFile(self):
fileExist = QFile.exists(_historyFile)
if fileExist:
rH = open(_historyFile, 'r')
rH = codecs.open(_historyFile, 'r', encoding='utf-8')
for line in rH:
if line != "\n":
l = line.rstrip('\n')
Expand All @@ -309,7 +310,7 @@ def clearHistory(self, clearSession=False):
return
ok = False
try:
cH = open(_historyFile, 'w')
cH = codecs.open(_historyFile, 'w', encoding='utf-8')
ok = True
except:
raise
Expand Down

0 comments on commit 577a72b

Please sign in to comment.