[ 
https://issues.apache.org/jira/browse/CAMEL-21199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17880946#comment-17880946
 ] 

Radovan Netuka edited comment on CAMEL-21199 at 9/11/24 11:48 AM:
------------------------------------------------------------------

It's problem of Jackson-core's {_}UTF8JsonGenerator{_}. Their other generator - 
_WriterBasedJsonGenerator_ - doesn't seem to suffer from this issue. 

 

While it'd be great to have this fixed on Jackson side, they keep the issue 
open from 2015 and rejected several PRs which were trying to provide a fix.

 

PR bellow tries to avoid the issue by forcing Jackson to use 
_WriterBasedJsonGenerator._ 

 

PR:

[https://github.com/apache/camel/pull/15515]


was (Author: rnetuka):
It's problem of Jackson-core's {_}UTF8JsonGenerator{_}. Their other generator - 
_WriterBasedJsonGenerator_ doesn't seem to suffer from this issue. 

 

While it'd be great to have this fixed on Jackson side, they keep the issue 
opened from 2015 and rejected several PRs which were trying to provide a fix.

 

PR bellow tries to avoid the issue by forcing Jackson to use 
_WriterBasedJsonGenerator._ 

 

PR:

https://github.com/apache/camel/pull/15515

> Camel-jackson not properly marshalling 4-byte characters
> --------------------------------------------------------
>
>                 Key: CAMEL-21199
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21199
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jackson
>            Reporter: Radovan Netuka
>            Assignee: Radovan Netuka
>            Priority: Major
>
> Camel-jackson doesn't handle 4-byte characters well. Marshalling a 4-byte 
> Japanese kanji character results in two UTF-16 escapes to be written instead 
> of the character itself. While this is ok for emoji an such, it's not for 
> natural languages.
> Jackson issue: 
> [FasterXML/jackson-core#223|https://github.com/FasterXML/jackson-core/issues/223]
>  
> Reproducer:
> {code:java}
> from("file:data?file-name=input.txt&noop=true")
>     .log("${body}")
>     .unmarshal().json(JsonLibrary.Jackson)
>     .log("${body[0]['name']}")
>     .marshal().json(JsonLibrary.Jackson, true)
>     .log("${body}"); {code}
>  
> with the file input.txt containing:
> {code:java}
> [{"name": "システム𩸽"}] {code}
>  
> Expected output seen in the log: *"システム𩸽"*
> Actual output seen in the log: *"システム\uD867\uDE3D"*



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to