# ConvertEncoding

| **Name**    | ***ConvertEncoding***                                                                                                                                                                                                                          |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | ConvertEncoding (String str, String fromCodePage, String toCodePage)                                                                                                                                                                           |
| Purpose     | To return a string in the given encoding.                                                                                                                                                                                                      |
| Description | Returns a string in the specified encoding, codepage value.                                                                                                                                                                                    |
| Return Type | String                                                                                                                                                                                                                                         |
| Parameters  | <p>Str \[System.String] – The string to convert</p><p>fromCodePage \[System.String] – The code page the string is currently encoded in. Default is UTF-8</p><p>toCodePage \[System.String] – The code page to convert to. Default is UTF-8</p> |

![](/files/JqJeESBb2nwncfOOPzsf)

**Example**

In this example, we are passing the required parameters to the function transformation object using a *Variables* object.

Where,

*str =* Helloαβ

*fromCodePage* = 65001 (UTF-8 - Default)

*toCodePage* = 20127 (US - ASCII)

![](/files/caBJLwGVUqSURLpwa7wl)

Right-click on the function transformation object and select *Preview Output.* You can see that Astera has returned a string in the *Output*. This means that the provided string’s encoding has been successfully converted

![](/files/t2DDnfOVomQcPgKMKEq9)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/functions/encoding/convertencoding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
