# CharsetEncode()

Uses the specified encoding to convert binary data to a string.

```
CharsetEncode( binary=binary, encoding=string );
```

**Returns:** string

# Arguments

| Argument | Type | Required | Description | Default |
|----------|------|----------|-------------|---------|
| binary | binary | Yes | A variable containing binary data to decode into text. *Alias: binaryData* |  |
| encoding | string | Yes | The character encoding that was used to encode the string into binary format. |  |

# Examples

```1
decoded = CharsetDecode("I am a string.", "utf-8");
dump(CharsetEncode(decoded, "utf-8")); // "I am a string"
```







# Categories

[Strings](../../categories/string.md)