I have made this class to subsitute the <convertBodyTo> tags. <from uri="file:/data/in" /> <bean ref="CharsetConverter" method="toExternalCharset" /> <bean ref="CharsetConverter" method="toInternalCharset" />
public class CharsetConverter { public void toInternalCharset(Exchange exchange) throws Exception { String internalCharset = Charset.defaultCharset().name(); String converted = new String(exchange.getIn().getBody(String.class).getBytes(), internalCharset); exchange.getIn().setBody(converted); exchange.setProperty(Exchange.CHARSET_NAME, internalCharset); } public void toExternalCharset(Exchange exchange) throws Exception { String externalCharset = exchange.getContext().resolvePropertyPlaceholders("{{charset.external}}"); System.out.println(externalCharset); String converted = new String(exchange.getIn().getBody(String.class).getBytes(), externalCharset); exchange.getIn().setBody(converted); exchange.setProperty(Exchange.CHARSET_NAME, externalCharset); } } However this does not produce the same (correct) output as using convertbodyto. -- View this message in context: http://camel.465427.n5.nabble.com/Charset-conversion-issue-tp3204282p3204529.html Sent from the Camel - Users mailing list archive at Nabble.com.