[BUG] 解析带有Protobuf编码数据的字符串出现乱码
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
解析带有Protobuf编码数据的字符串出现乱码
### 环境信息
*请填写以下信息:*
- OS信息: mac
- JDK信息: 1.8
- 版本信息:[e.g.:Fastjson2 2.0.40]
### 重现步骤
```java
String text = "{\"message\":\"\\u0008\\u0001\\u0012\\u00072041718 \\ufffd\\ufffd\\ufffd\u00810*\\u001b\\n\\u0004Tags\\u0012\\u0013{\\\"1\\\":{\\\"isTop\\\":\\\"0\\\"}}\"}";
JSONObject jsonObject = JSON.parseObject(text);
System.out.println(jsonObject.toJSONString());
// {"message":"\b\u0001\u0012\u00072041718 ���0*\u001b\n\u0004Tags\u0012\u0013{\"1\":{\"isTop\":\"0\"}}"}
```
### 期待的正确结果
按照原有格式解析输出
Contributor guide
Research direction
Start with the supplied Java reproducer and trace JSON.parseObject(text) through the string parsing and serialization path. Compare the parsed and re-serialized message against the original escaped content; done means the Protobuf-encoded characters are preserved without replacement characters or altered output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100