Skip to content
Permalink
Browse files

[pyqgis-console] more encoding fix.

  • Loading branch information
slarosa committed Aug 9, 2013
1 parent d61cb25 commit 577a72baf50730fb7d8f91eec8ba28a5923c0908
Showing with 5 additions and 4 deletions.
  1. +1 −1 python/console/console_editor.py
  2. +4 −3 python/console/console_sci.py
@@ -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()
@@ -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
@@ -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
@@ -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')
@@ -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

0 comments on commit 577a72b

Please sign in to comment.
You can’t perform that action at this time.