大佬求助:字符集错误导致文本无法正常显示
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 11k
- Forks
- 5.5k
- PR merge metrics
- No merged PRs in 30d
Description
为避免无效问题和冗余问题,提问前请确认
- 你确定Google不能解决你的问题
- 你确定已有的issue不能解决你的问题
- 你确定issue的title按照格式如下:[web/simple-web/server]:description
Describe the bug 描述你遇到的问题
书源可以缓存,但由于字符集不匹配无法正常显示
可以正常缓存,获取封面,获取目录
在reader安卓原版客户端上使用正常
To Reproduce 如何重现问题
Steps to reproduce the behavior: 把你遇到的问题的发生步骤替换掉下面的内容:
- 添加“速读谷”书源 https://www.yckceo.com/yuedu/shuyuan/json/id/5862.json
- 随便添加一本书到书架,我添加的是“夜无疆”
- 打开书籍
- 随便选中间的一个章节加载(这里很奇怪,第一次用这个书源的时候前两个章节都可以正常加载,后面突然不行了)
- 页面显示java字符集报错
对应log
[f26ccad3] [DefaultDispatcher-worker-2] 12:50:59.249 ERROR YueduApi - onHandlerError:
java.nio.charset.IllegalCharsetNameException: initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width
at java.nio.charset.Charset.checkName(Charset.java:315)
at java.nio.charset.Charset.lookup2(Charset.java:484)
at java.nio.charset.Charset.lookup(Charset.java:464)
at java.nio.charset.Charset.forName(Charset.java:528)
at io.legado.app.help.http.OkHttpUtilsKt.text(OkHttpUtils.kt:117)
at io.legado.app.help.http.OkHttpUtilsKt.text$default(OkHttpUtils.kt:102)
at io.legado.app.help.http.OkHttpUtilsKt.newCallStrResponse(OkHttpUtils.kt:78)
at io.legado.app.help.http.OkHttpUtilsKt$newCallStrResponse$1.invokeSuspend(OkHttpUtils.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Expected behavior 期待修复的效果
可以正常显示章节文本
Screenshots 如有必要,可以截图说明
版本说明
- OS: [e.g. win] Linux
- Deploy Method Docker
- Program Version 3.2.13
- Browser [e.g. chrome, safari] Chrome
Additional context 其他说明
Add any other context about the problem here. 添加你认为有必要的内容,否则不写。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at io.legado.app.help.http.OkHttpUtilsKt.text, especially line 117 in the stack trace, and reproduce the problem with the provided 速读谷 source and the “夜无疆” book. Check how the response charset is obtained; done means chapter text loads normally instead of raising IllegalCharsetNameException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100