Hi, we are using servicemix and I had a problem which was related to the time when that servicemix's JVM started. Aparently, it started before the operating system's locale was set to something UTF-8ish. I solved it (fingers crossed) by making sure that the system property "file.encoding" is explicitly set to "UTF-8"
This is the related background/documentation, i hope it sufficiently explains what the problem was about: # If the camel file component needs to write an InputStream to a file # and has to use a given encoding # and doesn't have enough info to do anything sophisticated, # then it creates a reader for the task, using "new InputStreamReader(is)". # This reader uses the "default charset" to interpret the stream. # Depending on when the JVM was started, the default charset might be ANSI_X3.4-1968 a.k.a. US-Ascii. # Now, when we create EDI files, the smooks' SmooksDataFormat creates a String and then writes it out as a UTF-8 encoded byte stream. # When this stream is read as US-Ascii, then all its nice Umlauts are turned into "??"s. # To prevent this, we explicitly set the default encoding to UTF-8 for the servicemix-JVM. .. and this is the code from FileOperations.storeFile() (camel-2.16.1), which creates the InputStreamReader from the the exchange's body <code> if (charset != null) { // charset configured so we must use a reader so we can write with encoding Reader in = exchange.getContext().getTypeConverter().tryConvertTo(Reader.class, exchange, exchange.getIn().getBody()); if (in == null) { // okay no direct reader conversion, so use an input stream (which a lot can be converted as) InputStream is = exchange.getIn().getMandatoryBody(InputStream.class); in = new InputStreamReader(is); } // buffer the reader in = IOHelper.buffered(in); writeFileByReaderWithCharset(in, file, charset); } else { </code> Now to my question: Could you point me to a best practice in my route (i'm specifying it via java-fluent) to tell camel "something", so that the tryConvertTo() method succeeds in creating an UTF-8-based reader? E.g. by setting some propery or something? It would relief us from worrying about that system property on the systems we deploy this component to. Best regards Tobi