mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Also decode bytes in comparable_price()
This commit is contained in:
parent
da24ae6480
commit
503d0e0113
@ -22,6 +22,8 @@ from calibre.utils.search_query_parser import SearchQueryParser
|
|||||||
def comparable_price(text):
|
def comparable_price(text):
|
||||||
if isinstance(text, (int, float)):
|
if isinstance(text, (int, float)):
|
||||||
text = str(text)
|
text = str(text)
|
||||||
|
if isinstance(text, bytes):
|
||||||
|
text = text.decode('utf-8', 'ignore')
|
||||||
text = text or ''
|
text = text or ''
|
||||||
# this keep thousand and fraction separators
|
# this keep thousand and fraction separators
|
||||||
match = re.search(r'(?:\d|[,.](?=\d))(?:\d*(?:[,.\' ](?=\d))?)+', text)
|
match = re.search(r'(?:\d|[,.](?=\d))(?:\d*(?:[,.\' ](?=\d))?)+', text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user