mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Making editing bytes as text alway decode as UTF-8 instead of repr()
This commit is contained in:
parent
fd77db2da5
commit
fa4713d1f3
@ -278,6 +278,8 @@ class TextEdit(PlainTextEdit):
|
|||||||
if self.smarts.override_tab_stop_width is not None:
|
if self.smarts.override_tab_stop_width is not None:
|
||||||
self.tw = self.smarts.override_tab_stop_width
|
self.tw = self.smarts.override_tab_stop_width
|
||||||
self.setTabStopWidth(self.tw * self.space_width)
|
self.setTabStopWidth(self.tw * self.space_width)
|
||||||
|
if isinstance(text, bytes):
|
||||||
|
text = text.decode('utf-8', 'replace')
|
||||||
self.setPlainText(unicodedata.normalize('NFC', unicode_type(text)))
|
self.setPlainText(unicodedata.normalize('NFC', unicode_type(text)))
|
||||||
if process_template and QPlainTextEdit.find(self, '%CURSOR%'):
|
if process_template and QPlainTextEdit.find(self, '%CURSOR%'):
|
||||||
c = self.textCursor()
|
c = self.textCursor()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user