camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hefiso <>
Subject Problem w. FTP producer and charset
Date Tue, 04 Dec 2012 12:29:07 GMT

It seems that the FTP producer is no longer able to write files using my
favorite charset "iso-8859-1". The latest version where it worked as
expected is 2.9.2 but from 2.9.3 and up the files are not written using the
specified charset.

I have attached a simple test showing this error. The route is:

<route id="foo-Route">
    <from uri="direct:in" />
    <convertBodyTo type="java.lang.String" charset="iso-8859-1" />

and the test goes like this:

	public void testFtpFileEncoding() throws InterruptedException, IOException
		String payload = "<foo>Halløj</foo>";
		template.sendBody("direct:in", payload);
		FileSystem fileSystem = fakeFtpServer.getFileSystem();
		FileEntry entry = (FileEntry)fileSystem.getEntry("/test_encoding.txt");
		InputStream inputStream = entry.createInputStream();

		StringWriter writer = new StringWriter();
		IOUtils.copy(inputStream, writer, "iso-8859-1");
		String res = writer.toString();
		assertEquals(payload, res);

When using Apache Camel 2.9.2 this works well. When upgrading to 2.9.3 or
higher (have tested with 2.10.0-2.10.3 as well) it fails because the file
gets written using utf-8 and not ios-8859-1 as specified :-/ You can test
this by changing the camel version in pom.xml.

The problem is not related to the MockFtpServer used in the JUnit-test as
the problem also exists when writing files to "real" FTP servers.

Do you have a fix or workaround for this?

Best regards

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message