From 715f3ed0e85ce4285a7128e3e20d8813808aaad3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 24 Oct 2019 12:18:59 +0800 Subject: [PATCH] up --- .../java/io/legado/app/service/HttpReadAloudService.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index 2a29b06c9..465e5e35f 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -107,7 +107,7 @@ class HttpReadAloudService : BaseReadAloudService(), private fun getAudioBody(content: String): Map { return mapOf( - Pair("tex", URLEncoder.encode(URLEncoder.encode(content, "UTF-8"), "UTF-8")), + Pair("tex", encodeTwo(content)), Pair("spd", ((getPrefInt("ttsSpeechRate", 25) + 5) / 5).toString()), Pair("per", getPrefString("ttsSpeechPer") ?: "0"), Pair("cuid", "baidu_speech_demo"), @@ -122,6 +122,14 @@ class HttpReadAloudService : BaseReadAloudService(), ) } + private fun encodeTwo(content: String): String { + return try { + URLEncoder.encode(URLEncoder.encode(content, "UTF-8"), "UTF-8") + } catch (e: Exception) { + "" + } + } + override fun pauseReadAloud(pause: Boolean) { super.pauseReadAloud(pause) mediaPlayer.pause()