mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-29 08:16:48 +01:00
Fix #784
This commit is contained in:
parent
48930e7847
commit
ee9316a76c
1 changed files with 4 additions and 1 deletions
|
|
@ -46,7 +46,10 @@ def xml_to_unicode(raw, verbose=False):
|
|||
if match is not None:
|
||||
encoding = match.group(1)
|
||||
if encoding is None:
|
||||
chardet = detect(raw)
|
||||
try:
|
||||
chardet = detect(raw)
|
||||
except:
|
||||
chardet = {'encoding':'utf-8', 'confidence':0}
|
||||
encoding = chardet['encoding']
|
||||
if chardet['confidence'] < 1 and verbose:
|
||||
print 'WARNING: Encoding detection confidence %d%%'%(chardet['confidence']*100)
|
||||
|
|
|
|||
Loading…
Reference in a new issue