mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Output detected encoding as well in the warning
This commit is contained in:
parent
e9c6dbc24b
commit
6482a66bb7
@ -73,8 +73,8 @@ def force_encoding(raw, verbose, assume_utf8=False):
|
|||||||
if chardet['confidence'] < 1 and assume_utf8:
|
if chardet['confidence'] < 1 and assume_utf8:
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
if chardet['confidence'] < 1 and verbose:
|
if chardet['confidence'] < 1 and verbose:
|
||||||
print('WARNING: Encoding detection confidence %d%%'%(
|
print('WARNING: Encoding detection confidence for %s is %d%%'%(
|
||||||
chardet['confidence']*100))
|
chardet['encoding'], chardet['confidence']*100))
|
||||||
if not encoding:
|
if not encoding:
|
||||||
encoding = preferred_encoding
|
encoding = preferred_encoding
|
||||||
encoding = encoding.lower()
|
encoding = encoding.lower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user