Repository navigation
Conversation
Copy the Apache response entity as raw bytes so a missing charset cannot re-encode UTF-8 JSON or binary data as US-ASCII.
|
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文
修改目的
修复 #16053。
同步 Apache HTTP 客户端读取未声明 charset 的
application/jsonUTF-8 响应时,会先把实体读成字符串,再按缺失 charset 时的 US-ASCII 编码回字节。中文和 emoji 会被替换为问号,二进制响应也可能损坏。显式声明charset=UTF-8时,相同内容可以完整读取。字节保留方案和原始复现基于 asaid364 在 #16053 中的调查。
主要改动
验证情况
mvn -B -pl common -am test:API 模块 1466 项、Common 模块 1057 项测试通过。English
What is the purpose of the change
Fixes #16053.
The synchronous Apache HTTP adapter reads a response entity into a string and then encodes it back to bytes. When
Content-Typehas no charset, that encoding uses US-ASCII, so Chinese text and emoji in UTF-8 JSON become question marks and binary bodies can change. The same content is preserved when the response explicitly declarescharset=UTF-8.The byte-preservation approach and original reproduction build on the investigation in #16053 by asaid364.
Brief changelog
Verifying this change
mvn -B -pl common -am test: 1466 API tests and 1057 Common tests passed.