mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[pyqgis-console] more encoding fix.
This commit is contained in:
parent
d61cb25479
commit
577a72baf5
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user