> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# messageRead

> Reads the contents of a message item and returns the entire message body as a single output string, with support for various character encodings.

Reads the contents of a message item and returns the message body in a single output string.

## Optional Parameters

* **encoding**: The encoding to use to decode the message data as string. The allowed values are determined by the JVM/OS being used. Values for encodings that are generally supported by most operating systems and JVMs include `UTF-8`, `ASCII`, `BASE64`, `Hex`, `windows-1252`, and `ISO-8859-2`. The default is `UTF-8`.

## Output Attributes

* **data**: The message data.

## Example

### Replace Commas with Pipe Characters ( | )

```xml theme={null}
<!-- Calling messageRead and replacing all commmas with pipes -->
<arc:call op="messageRead" out="result" >
  <arc:set attr="messageOut.data" value="[result.data | replace(',','|')]" />
</arc:call>

<!-- Checking to make sure the output message has data, else throw an error -->
<arc:check attr="messageOut.data" >
  <arc:set attr="messageOut.filename" value="[FileName]" />
  <arc:push item="messageOut" />
  <arc:else>
    <arc:throw code="NoData" desc="No message data." />
  </arc:else>
</arc:check>
```
