Specify charset for ZIP chapters when using Android N+ (fixes #905)

This commit is contained in:
arkon 2020-05-16 15:22:02 -04:00
parent 620be2617a
commit e810b343cf

View file

@ -1,10 +1,12 @@
package eu.kanade.tachiyomi.ui.reader.loader package eu.kanade.tachiyomi.ui.reader.loader
import android.os.Build
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder import eu.kanade.tachiyomi.util.lang.compareToCaseInsensitiveNaturalOrder
import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.ImageUtil
import java.io.File import java.io.File
import java.nio.charset.StandardCharsets
import java.util.zip.ZipEntry import java.util.zip.ZipEntry
import java.util.zip.ZipFile import java.util.zip.ZipFile
import rx.Observable import rx.Observable
@ -17,7 +19,11 @@ class ZipPageLoader(file: File) : PageLoader() {
/** /**
* The zip file to load pages from. * The zip file to load pages from.
*/ */
private val zip = ZipFile(file) private val zip = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
ZipFile(file, StandardCharsets.ISO_8859_1)
} else {
ZipFile(file)
}
/** /**
* Recycles this loader and the open zip. * Recycles this loader and the open zip.