[
https://issues.apache.org/jira/browse/GROOVY-10685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17564913#comment-17564913
]
Paul King commented on GROOVY-10685:
------------------------------------
Ah, I forgot we already support this:
{code}
import groovy.json.*
def map = [你好: "好的"]
def out = new JsonGenerator.Options()
.disableUnicodeEscaping()
.build()
println out.toJson(map)
{code}
Output:
{code}
{"你好":"好的"}
{code}
> the default JsonOutput.toJson() can't handle when the String is chinese.
> ------------------------------------------------------------------------
>
> Key: GROOVY-10685
> URL: https://issues.apache.org/jira/browse/GROOVY-10685
> Project: Groovy
> Issue Type: Wish
> Reporter: zouchangpeng
> Priority: Minor
> Attachments: image-2022-07-09-08-56-35-658.png,
> image-2022-07-09-08-57-15-627.png, image-2022-07-09-10-12-16-325.png,
> image-2022-07-09-10-12-40-593.png, image-2022-07-09-10-12-58-077.png
>
>
> when i use the default JsonOutput.toJson() ,the String is chinese,output is
> not chinses, like unicode。
> !image-2022-07-09-08-56-35-658.png!
>
> output:
> !image-2022-07-09-08-57-15-627.png!
>
> i hope when the String is chinese, the output is alse chinese, like Gson, for
> example.
> !image-2022-07-09-10-12-58-077.png!
>
> output:
> !image-2022-07-09-10-12-40-593.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)