Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-609

Unable to write converted body to file using alternative character sets

    Details

    • Similar Issues:
      Show 9 results 

      Description

      Consider the following route:

      <route>
        <from uri="file:./dir_in" />
        <convertBodyTo type="java.lang.byte[]" charset="iso-8859-1"/>
        <to   uri="file:./dir_out?charset=ISO-8859-1&amp;fileName=test2.xml" />
        <log message= "File converted" />
      </route>

      In a test file containing special chars (!"#$%) which are utf values of 21, 22, 23, 24, 25 and 0A accordingly we can see that they appear to be translated properly to iso-8859-1:

       
      2012-04-24 15:26:50,750 [file://./dir_in] TRACE DefaultTypeConverter           - Converting byte[] -> java.io.File with value: [33, 34, 35, 36, 37, 10]
      2012-04-24 15:26:50,757 [file://./dir_in] TRACE DefaultTypeConverter           - Converting org.apache.camel.component.file.GenericFileMessage -> java.io.File with value: null
      2012-04-24 15:26:50,757 [file://./dir_in] TRACE DefaultTypeConverter           - Converting byte[] -> java.io.InputStream with value: [33, 34, 35, 36, 37, 10]
      2012-04-24 15:26:50,757 [file://./dir_in] TRACE DefaultTypeConverter           - Using converter: StaticMethodTypeConverter: public static java.io.InputStream org.apache.camel.converter.IOConverter.toInputStream(byte[]) to convert [class [B=>class java.io.InputStream]
       

      However, when they are written back out to the file they are translated back to UTF-8 base. I suspect this is because we use string internally but I'm not 100%.

      Simple test case attached.

        Gliffy Diagrams

          Activity

          Hide
          davsclaus Claus Ibsen added a comment -
          Show
          davsclaus Claus Ibsen added a comment - Also related is https://issues.apache.org/jira/browse/CAMEL-5216
          Hide
          davsclaus Claus Ibsen added a comment -

          Backported to Fuse Camel 2.9

          Show
          davsclaus Claus Ibsen added a comment - Backported to Fuse Camel 2.9
          Hide
          davsclaus Claus Ibsen added a comment -

          Backported to 2.8 as well.

          Show
          davsclaus Claus Ibsen added a comment - Backported to 2.8 as well.

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              sjavurek Susan Javurek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: