From 7e4d35b066e58ded524598393d2fde9197e01d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 2 Jan 2024 05:03:16 +0800 Subject: [PATCH] Picacomic: Fix json decoding error of non-ASCII chars (#19434) (#19515) * Picacomic: Fix json decoding error of non-ASCII chars (#19434) Caused by #19400 * bump version code to 4 * replace decodeToString with toString --- src/zh/picacomic/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/zh/picacomic/Picacomic.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zh/picacomic/build.gradle b/src/zh/picacomic/build.gradle index ef58c6feb..960c6770f 100644 --- a/src/zh/picacomic/build.gradle +++ b/src/zh/picacomic/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Picacomic' pkgNameSuffix = 'zh.picacomic' extClass = '.Picacomic' - extVersionCode = 3 + extVersionCode = 4 isNsfw = true } diff --git a/src/zh/picacomic/src/eu/kanade/tachiyomi/extension/zh/picacomic/Picacomic.kt b/src/zh/picacomic/src/eu/kanade/tachiyomi/extension/zh/picacomic/Picacomic.kt index e62713e7e..cfb3af379 100644 --- a/src/zh/picacomic/src/eu/kanade/tachiyomi/extension/zh/picacomic/Picacomic.kt +++ b/src/zh/picacomic/src/eu/kanade/tachiyomi/extension/zh/picacomic/Picacomic.kt @@ -30,6 +30,7 @@ import org.json.JSONObject import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.net.URLEncoder +import java.nio.charset.Charset import java.text.SimpleDateFormat import java.util.Date import java.util.Locale @@ -100,7 +101,7 @@ class Picacomic : HttpSource(), ConfigurableSource { ) } - val payload = parts[1]?.let { JSONObject(String(Base64.decode(it, Base64.DEFAULT))) } + val payload = parts[1]?.let { JSONObject(Base64.decode(it, Base64.DEFAULT).toString(Charsets.UTF_8)) } val exp = payload?.getLong("exp")?.let { Date(it * 1000)