From fe1b7fe739d7714fb4a7c1839d6ca06db6ca57f3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Mar 2014 12:44:22 +0530 Subject: [PATCH] ... --- src/calibre/gui2/tweak_book/editor/text.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index c319feaea7..fb4f39183a 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -25,6 +25,7 @@ from calibre.gui2.tweak_book.editor.syntax.html import HTMLHighlighter, XMLHighl from calibre.gui2.tweak_book.editor.syntax.css import CSSHighlighter from calibre.gui2.tweak_book.editor.smart import NullSmarts from calibre.gui2.tweak_book.editor.smart.html import HTMLSmarts +from calibre.utils.icu import safe_chr PARAGRAPH_SEPARATOR = '\u2029' entity_pat = re.compile(r'&(#{0,1}[a-zA-Z0-9]{1,8});') @@ -628,10 +629,9 @@ class TextEdit(PlainTextEdit): return False if num > 0x10ffff or num < 1: return False - from calibre.gui2.tweak_book.char_select import chr end_pos = max(c.anchor(), c.position()) c.setPosition(end_pos - len(text)), c.setPosition(end_pos, c.KeepAnchor) - c.insertText(chr(num)) + c.insertText(safe_chr(num)) return True def replace_possible_entity(self):