We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
对不可见字符没有处理,会引起异常 比如换行符现在可以转换成\n,但ascii为17的不可见字符没有处理,会引起异常。不是特定为17,是所有的不可见字符。
请填写以下信息:
char abc = 17; String str = "{\"test\": \"Pixel 民" + String.valueOf(abc) + "\n XL\"}"; Object object = com.alibaba.fastjson2.JSON.parse(str); System.out.println(com.alibaba.fastjson.JSON.toJSONString(object, SerializerFeature.BrowserCompatible)); System.out.println(com.alibaba.fastjson2.JSON.toJSONString(object, JSONWriter.Feature.BrowserCompatible)); ObjectMapper objectMapper = new ObjectMapper(); System.out.println(objectMapper.writeValueAsString(object)); ////输出结果 {"test":"Pixel \u6C11\u0011\n XL"}//中文被编码 {"test":"Pixel 民�\n XL"}//abc没有被编码 {"test":"Pixel 民\u0011\n XL"}//预期的结果
The text was updated successfully, but these errors were encountered:
bug fix for write invisible characters, for issue #435
9d9f5d0
https://github.com/alibaba/fastjson2/releases/tag/2.0.7 问题已经修复,请用新版本
Sorry, something went wrong.
No branches or pull requests
问题描述
对不可见字符没有处理,会引起异常
比如换行符现在可以转换成\n,但ascii为17的不可见字符没有处理,会引起异常。不是特定为17,是所有的不可见字符。
环境信息
请填写以下信息:
重现步骤
The text was updated successfully, but these errors were encountered: