mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #2041 (Error fetching news la repubblica on MacOSX)
This commit is contained in:
parent
00bd62d92d
commit
759ca69205
@ -1306,7 +1306,10 @@ class BeautifulStoneSoup(Tag, SGMLParser):
|
|||||||
if self.convertEntities:
|
if self.convertEntities:
|
||||||
if ref.lower().startswith('x'): #
|
if ref.lower().startswith('x'): #
|
||||||
ref = int(ref[1:], 16) # Added by Kovid to handle hex numeric entities
|
ref = int(ref[1:], 16) # Added by Kovid to handle hex numeric entities
|
||||||
|
try:
|
||||||
data = unichr(int(ref))
|
data = unichr(int(ref))
|
||||||
|
except ValueError: # Bad numerical entity. Added by Kovid
|
||||||
|
data = u''
|
||||||
else:
|
else:
|
||||||
data = '&#%s;' % ref
|
data = '&#%s;' % ref
|
||||||
self.handle_data(data)
|
self.handle_data(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user