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()