# Javascript: TXTextControl.btoaUTF8 Method

> Creates a base-64 encoded ASCII string from a unicode string. In contrast to the browser provided method btoa() this method handles all unicode characters and not only characters in the Latin1 range.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 27.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TXTextControl.btoaUTF8 Method
- **258 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/btoautf8-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/btoautf8-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/btoautf8-method/llms-full.txt

---

### Description

Creates a base-64 encoded ASCII string from a unicode string. In contrast to the browser provided method btoa() this method handles all unicode characters and not only characters in the Latin1 range.

### Syntax

```javascript
<string> TXTextControl.btoaUTF8(<string> inputString, [<boolean> addBOM])
```

### Parameters

| Parameter | Description |
|---|---|
| inputString | A unicode string to be encoded into base-64. |
| addBOM | Optional. Set this to true if a byte order mark should be added to the encoded string. |

### Return Value

A base-64 encoded string.

### Examples

The following example demonstrates `TXTextControl.btoaUTF8` in a practical document-editing workflow. It creates a base-64 encoded ASCII string from a unicode string. In contrast to the browser provided method btoa() this method handles all unicode characters and not only characters in the Latin1 range.

```javascript
TXTextControl.btoaUTF8("Quarterly report", true);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.BreakType Enumeration](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/breaktype-enumeration/llms-full.txt)
- **Next:** [Javascript: TXTextControl.CapitalizationSettings Enumeration](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/capitalizationsettings-enumeration/llms-full.txt)
