If you want to set a dynamic charset, then you can set it as exchange
property before calling convert body to

<setProperty propertyName="Exchange.CHARSET_NAME">
   <simple>${property.mailCharSet}</simple>
</setProperty>
<convertBody ...>

On Fri, Jan 12, 2018 at 4:55 PM, Daniel Langevin
<daniel.lange...@shq.gouv.qc.ca> wrote:
> Ok Thanks.
> I know that way, but can't be Dynamic
>
>
> Regards
>
> Daniel
>
>
>
>
>
>
>>>> Claus Ibsen <claus.ib...@gmail.com> 2018-01-12 10:51 >>>
> You cannot make it as a dynamic value computed from each message, but
> you can configure it externally using property placeholders. For the
> latter read the documentation
> http://camel.apache.org/using-propertyplaceholder.html
>
> On Fri, Jan 12, 2018 at 4:23 PM, Daniel Langevin
> <daniel.lange...@shq.gouv.qc.ca> wrote:
>> Hi,
>>
>> i try to use convertBody to and pass the charset dynamically.
>>
>>
>> i try:
>> #1
>> <setProperty propertyName="mailCharSet"><groovy> ...... retrieve
> charSet BodyPart from mail</groovy></setProperty>
>>  <convertBodyTo type="java.lang.String"
> charset="${property.mailCharSet}"></convertBodyTo>
>>
>> but receive error
>> Caused by: java.nio.charset.IllegalCharsetNameException:
> ${property.mailCharSet}
>>
>> #2
>> <setProperty propertyName="mailCharSet"><groovy> ...... retrieve
> charSet BodyPart from mail</groovy></setProperty>
>> <convertBodyTo type="java.lang.String"
> charset="{{mailCharSet}}"></convertBodyTo>
>>
>> but receive error
>> Caused by: java.lang.IllegalArgumentException: Property with key
> [mailCharSet] not found in properties from text: {{mailCharSet}}
>> ..... is searching  property key mailCharSet from my property
> folder., but this one cannot be Dynamic !
>>
>> #3
>> add this property key in my property file
>> charset_UTF-8=utf-8
>>
>> <setProperty
> propertyName="mailCharSet"><constant>UTF-8</constant></setProperty>
>> <convertBodyTo type="java.lang.String"
> charset="{{charset_${property.mailCharSet}}}"></convertBodyTo>
>>
>> but receive error
>> Caused by: java.lang.IllegalArgumentException: Property with key
> [charset_${property.mailCharSet] not found in properties from text:
> {{charset_${property.mailCharSet}}}
>> ... substitution doesn't work !!?!! it supposed to search
> charset_UTF-8 into property folder !
>>
>> There is a way to achieve that ?  Someone have an idea !
>>
>>
>> Daniel
>>
>>
>>
>>
>>
>>
>>
>> "Le présent courriel peut contenir des renseignements confidentiels
> et ne s'adresse qu'au destinataire dont le nom apparaît ci-dessus. Si ce
> courriel vous est parvenu par mégarde, veuillez le supprimer et nous en
> aviser aussitôt."
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
>
> "Le présent courriel peut contenir des renseignements confidentiels et ne 
> s'adresse qu'au destinataire dont le nom apparaît ci-dessus. Si ce courriel 
> vous est parvenu par mégarde, veuillez le supprimer et nous en aviser 
> aussitôt."



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to