Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21199

Camel-jackson not properly marshalling 4-byte characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.9.0
    • camel-jackson
    • None

    Description

      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

       

      Reproducer:

      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}"); 

       
      with the file input.txt containing:

      [{"name": "システム𩸽"}] 

       

      Expected output seen in the log: "システム𩸽"

      Actual output seen in the log: "システム\uD867\uDE3D"

      Attachments

        Activity

          People

            rnetuka Radovan Netuka
            rnetuka Radovan Netuka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: