К предыдущему

This commit is contained in:
Book Pauk
2019-02-13 13:44:34 +07:00
parent 9a44f53e5f
commit 6b9ad4a947

View File

@@ -80,8 +80,10 @@ class BookConverter {
const m = head.match(/encoding="(.*)"/); const m = head.match(/encoding="(.*)"/);
if (m) { if (m) {
let encoding = m[1].toLowerCase(); let encoding = m[1].toLowerCase();
if (encoding != 'utf-8') if (encoding != 'utf-8') {
result = iconv.decode(data, encoding); result = iconv.decode(data, encoding);
result = Buffer.from(result.toString().replace(m[0], 'encoding="utf-8"'));
}
} }
} }
} }