Chapter 310. String Encoding DataFormat
Available as of Camel version 2.12
The String Data Format is a textual based format that supports encoding.
310.1. Options
The String Encoding dataformat supports 2 options which are listed below.
| Name | Default | Java Type | Description |
|---|---|---|---|
| charset |
| Sets an encoding to use. Will by default use the JVM platform default charset. | |
| contentTypeHeader |
|
| Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. |
310.2. Marshal
In this example we marshal the file content to String object in UTF-8 encoding.
from("file://data.csv").marshal().string("UTF-8").to("jms://myqueue");310.3. Unmarshal
In this example we unmarshal the payload from the JMS queue to a String object using UTF-8 encoding, before its processed by the newOrder processor.
from("jms://queue/order").unmarshal().string("UTF-8").processRef("newOrder");310.4. Dependencies
This data format is provided in camel-core so no additional dependencies is needed.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.