camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarmo Sorvari <>
Subject Converting a utf-16 file
Date Thu, 08 Oct 2015 15:41:22 GMT

We fetch N files via sftp.

Some of these files are large, so we use the localWorkDirectory option, to save jvm memory.

One of these files we have to check for a keyword to decide between success and failure, using

<simple>${bodyAs(String)} contains 'keyword'</simple>

which would work fine, except that this one file of all N files is utf-16.

How would I go about changing the encoding of this file? It does not matter if it changes

Trials with <convertBodyTo ... /> have failed (errors about invalid xml -- which does
not happen with iso-latin or utf-8 files) so far.

Or can I avoid conversion altogether, i.e., can I tell ${bodyAs()... that the contents are
utf-16, when "contains" could maybe work?

Routing based on filename + data conversion bean, maybe?

I would prefer to do this with XML DSL as far as possible.

Thanks in advance!

Jarmo Sorvari
Tampere University of Applied Sciences

View raw message