Details
-
Bug
-
Resolution: Done
-
Major
-
2.8.0-fuse-03-06
-
None
-
None
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&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.