Edit Book: Fix subsetting of fonts not working if the text contains non-BMP unicode characters. Fixes #1349856 [Error using "Subset all Fonts"](https://bugs.launchpad.net/calibre/+bug/1349856)

This commit is contained in:
Kovid Goyal 2014-07-30 09:35:40 +05:30
parent 5c249d279b
commit a799191771

View File

@ -133,7 +133,9 @@ class Page(QWebPage): # {{{
return QString(val)
def _pass_json_value_setter(self, value):
self.bridge_value = json.loads(unicode(value))
# Qt WebKit in Qt 4.x adds extra null bytes to the end of the string
# if the JSON contains non-BMP characters
self.bridge_value = json.loads(unicode(value).rstrip('\0'))
_pass_json_value = pyqtProperty(QString, fget=_pass_json_value_getter,
fset=_pass_json_value_setter)