From dcce2d864c0c8a16ce125dfa2f09a4f12383336b Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 26 Aug 2020 21:45:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=9C=AC=E5=9C=B0=E4=B9=A6?= =?UTF-8?q?=E7=B1=8D=E7=BC=96=E7=A0=81=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt b/app/src/main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt index c4bfb6ea6..41caca4a9 100644 --- a/app/src/main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt +++ b/app/src/main/java/io/legado/app/model/localBook/AnalyzeTxtFile.kt @@ -20,7 +20,9 @@ class AnalyzeTxtFile { @Throws(Exception::class) fun analyze(book: Book): ArrayList { val bookFile = getBookFile(book) - book.charset = EncodingDetect.getEncode(bookFile) + if (book.charset == null) { + book.charset = EncodingDetect.getEncode(bookFile) + } charset = book.fileCharset() val rulePattern = if (book.tocUrl.isNotEmpty()) { Pattern.compile(book.tocUrl, Pattern.MULTILINE)