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

# messageRead

> 读取当前消息内容，支持编码转换和文本替换。

读取消息项的内容，并返回单个输出字符串中的消息正文。

## 可选的参数

* **encoding**：用于将消息数据解码为字符串的编码。允许的值由所使用的 JVM/OS 决定。大多数操作系统和 JVM 通常支持的编码值包括`UTF-8`、`ASCII`、`BASE64`、`Hex`、`windows-1252`和`ISO-8859-2`。默认值为 `UTF-8`。

## 输出属性

* **data**: 消息内容。

## 示例

### 将逗号（,）替换为竖线字符（|）

```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>
```
