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