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)