[pyqgis-console] more encoding fix.

This commit is contained in:
Salvatore Larosa 2013-08-10 00:55:41 +02:00
parent d61cb25479
commit 577a72baf5
2 changed files with 5 additions and 4 deletions

View File

@ -576,7 +576,7 @@ class Editor(QsciScintilla):
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()

View File

@ -29,6 +29,7 @@ from PyQt4.Qsci import (QsciScintilla,
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
return
ok = False
try:
cH = open(_historyFile, 'w')
cH = codecs.open(_historyFile, 'w', encoding='utf-8')
ok = True
except:
raise