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

    XMLWordPrintable

Details

    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.

      Attachments

        Activity

          People

            cibsen@redhat.com Claus Ibsen
            rhn-support-sjavurek Susan Javurek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: