mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression in converting HTML files that have non ASCII characters inside their <style> tags. Apparently Word generates these. Fixes #8494 (trouble converting htm files (for john))
This commit is contained in:
parent
e42664da72
commit
57883c120e
@ -221,7 +221,10 @@ def rewrite_links(root, link_repl_func, resolve_base_href=False):
|
|||||||
el.text):
|
el.text):
|
||||||
stylesheet = parseString(el.text)
|
stylesheet = parseString(el.text)
|
||||||
replaceUrls(stylesheet, link_repl_func)
|
replaceUrls(stylesheet, link_repl_func)
|
||||||
el.text = '\n'+stylesheet.cssText + '\n'
|
repl = stylesheet.cssText
|
||||||
|
if isbytestring(repl):
|
||||||
|
repl = repl.decode('utf-8')
|
||||||
|
el.text = '\n'+ repl + '\n'
|
||||||
|
|
||||||
if 'style' in el.attrib:
|
if 'style' in el.attrib:
|
||||||
text = el.attrib['style']
|
text = el.attrib['style']
|
||||||
@ -234,8 +237,11 @@ def rewrite_links(root, link_repl_func, resolve_base_href=False):
|
|||||||
set_property(item)
|
set_property(item)
|
||||||
elif v.CSS_PRIMITIVE_VALUE == v.cssValueType:
|
elif v.CSS_PRIMITIVE_VALUE == v.cssValueType:
|
||||||
set_property(v)
|
set_property(v)
|
||||||
el.attrib['style'] = stext.cssText.replace('\n', ' ').replace('\r',
|
repl = stext.cssText.replace('\n', ' ').replace('\r',
|
||||||
' ')
|
' ')
|
||||||
|
if isbytestring(repl):
|
||||||
|
repl = repl.decode('utf-8')
|
||||||
|
el.attrib['style'] = repl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user