mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix unicode handling when editing tweaks
This commit is contained in:
parent
05acab2c34
commit
6eade64d80
@ -515,15 +515,15 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
|
||||
self.reset_confirmation_button.clicked.connect(self.reset_confirmation)
|
||||
|
||||
deft, curt = read_raw_tweaks()
|
||||
self.current_tweaks.setPlainText(curt)
|
||||
self.default_tweaks.setPlainText(deft)
|
||||
self.current_tweaks.setPlainText(curt.decode('utf-8'))
|
||||
self.default_tweaks.setPlainText(deft.decode('utf-8'))
|
||||
self.restore_tweaks_to_default_button.clicked.connect(self.restore_tweaks_to_default)
|
||||
|
||||
self.category_view.setCurrentIndex(self.category_view.model().index_for_name(initial_category))
|
||||
|
||||
def restore_tweaks_to_default(self, *args):
|
||||
deft, curt = read_raw_tweaks()
|
||||
self.current_tweaks.setPlainText(deft)
|
||||
self.current_tweaks.setPlainText(deft.decode('utf-8'))
|
||||
|
||||
|
||||
def reset_confirmation(self):
|
||||
@ -698,8 +698,7 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
|
||||
self.input_order.setCurrentRow(idx-1)
|
||||
|
||||
def set_tweaks(self):
|
||||
raw = unicode(self.current_tweaks.toPlainText())
|
||||
raw = re.sub(r'(?m)^#.*fileencoding.*', '# ', raw)
|
||||
raw = unicode(self.current_tweaks.toPlainText()).encode('utf-8')
|
||||
try:
|
||||
exec raw
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user