You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jarmo Sorvari <ja...@tamk.fi> on 2015/10/08 17:41:22 UTC

Converting a utf-16 file

Hi

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 permanently.

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
Finland