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

Provide possibility to delegate charset evaluation of a HL7 message to HL7DataFormat

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.14.1, 2.15.0
    • camel-hl7
    • None
    • Patch Available
    • Moderate

    Description

      The HL7Codec directly creates a String from the message, using the charset hardcoded in its HL7MLLPConfig. This is too static.

      • The field MSH-18 of the message may contain the charset in which the message is encoded (much like encoding=... in the XML header) and which shall be used for decoding.
      • Other information nested the exchange may also be usable to derive the appropriate charset if MSH-18 is empty.

      The attached patch improves the behavior in a backwards-compatible way.

      • HL7MLLPCodec has a new property named "produceString" (default true). If set to false, the codec sends a byte array into the route instead of a string. In this case, no charset is evaluated yet.
      • the HL7DataFormat checks the field MSH-18 for the charset to be used for marshalling and unmarshalling. If MSH-18 is empty, it uses the standard Camel charset properties/headers by default. If MSH-18 was populated, the value is copied to a new message header "CamelHL7Charset"
      • the HL7DataFormat also offers an extension point in order to "guess" the charset from the byte array content (e.g. using ICU4J's CharsetDetector).

      Attachments

        1. PATCH-8079.diff
          37 kB
          Christian Ohr

        Activity

          People

            davsclaus Claus Ibsen
            ohr Christian Ohr
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: