E-book viewer: Ensure CSS stylesheets are interpreted as UTF-8. Fixes #2021554 [The E-book viewer displays a CSS inserted em dash as an encoding error](https://bugs.launchpad.net/calibre/+bug/2021554)

This commit is contained in:
Kovid Goyal 2023-05-30 20:43:44 +05:30
parent bb3bb53270
commit c5d4ece489
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -149,6 +149,8 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler):
'application/x-font-truetype':'application/x-font-ttf', 'application/x-font-truetype':'application/x-font-ttf',
'application/font-sfnt': 'application/x-font-ttf', 'application/font-sfnt': 'application/x-font-ttf',
}.get(mime_type, mime_type) }.get(mime_type, mime_type)
if mime_type == 'text/css':
mime_type += '; charset=utf-8'
send_reply(rq, mime_type, data) send_reply(rq, mime_type, data)
except Exception: except Exception:
import traceback import traceback