Улучшил распознавание кодировки
This commit is contained in:
@@ -140,7 +140,17 @@ class BookConverter {
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
await parser.parse(iconv.decode(data, chardet.detect(data)));
|
const charsetAll = chardet.detectAll(data);
|
||||||
|
|
||||||
|
let selected = 'ISO-8859-1';
|
||||||
|
for (const charset of charsetAll) {
|
||||||
|
if (charset.name.indexOf('ISO-8859') < 0) {
|
||||||
|
selected = charset.name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await parser.parse(iconv.decode(data, selected));
|
||||||
|
|
||||||
const title = (titleInfo['book-title'] ? titleInfo['book-title'] : '');
|
const title = (titleInfo['book-title'] ? titleInfo['book-title'] : '');
|
||||||
let author = '';
|
let author = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user