mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #1870 (ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes)
This commit is contained in:
parent
2f7f23580f
commit
ee950ce4c7
@ -504,8 +504,14 @@ class Parser(PreProcessor, LoggingInterface):
|
||||
'</p><pre>%s</pre></body></html>'%err)
|
||||
self.head = self.root.xpath('./head')[0]
|
||||
self.body = self.root.body
|
||||
invalid_counter = 0
|
||||
for a in self.root.xpath('//a[@name]'):
|
||||
a.set('id', a.get('name'))
|
||||
try:
|
||||
a.set('id', a.get('name'))
|
||||
except:
|
||||
invalid_counter += 1
|
||||
for x in ('id', 'name'):
|
||||
a.set(x, 'calibre_invalid_id_%d'%invalid_counter)
|
||||
if not self.head.xpath('./title'):
|
||||
title = etree.SubElement(self.head, 'title')
|
||||
title.text = _('Unknown')
|
||||
|
Loading…
x
Reference in New Issue
Block a user