---
title: "tinymce.html.Entities"
description: "Entity encoder class."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.html.entities/"
md_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.html.entities/index.md"
version: "latest"
last_updated: "2022-07-13T05:38:26Z"
tokens: 855
---
# tinymce.html.Entities

Entity encoder class.

## Summary

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [decode()](#decode) | Decodes the specified string, this will replace entities with raw UTF characters. | `Entities` |
| [encodeAllRaw()](#encodeAllRaw) | Encoded the specified text with both the attributes and text entities. This function will produce larger text contents since it doesn’t know if the context is within an attribute or text node. This was added for compatibility and is exposed as the `DOMUtils.encode` function. | `Entities` |
| [encodeNamed()](#encodeNamed) | Encodes the specified string using named entities. The core entities will be encoded as named ones but all non lower ascii characters will be encoded into named entities. | `Entities` |
| [encodeNumeric()](#encodeNumeric) | Encodes the specified string using numeric entities. The core entities will be encoded as named ones but all non lower ascii characters will be encoded into numeric entities. | `Entities` |
| [encodeRaw()](#encodeRaw) | Encodes the specified string using raw entities. This means only the required XML base entities will be encoded. | `Entities` |
| [getEncodeFunc()](#getEncodeFunc) | Returns an encode function based on the name(s) and it’s optional entities. | `Entities` |

## Methods

### decode()

```javascript
decode(text: String): String
```
Decodes the specified string, this will replace entities with raw UTF characters.

#### Parameters

- `text (String)` - Text to entity decode.

#### Return value

- `String` - Entity decoded string.

### encodeAllRaw()

```javascript
encodeAllRaw(text: String): String
```
Encoded the specified text with both the attributes and text entities. This function will produce larger text contents
since it doesn’t know if the context is within an attribute or text node. This was added for compatibility
and is exposed as the `DOMUtils.encode` function.

#### Parameters

- `text (String)` - Text to encode.

#### Return value

- `String` - Entity encoded text.

### encodeNamed()

```javascript
encodeNamed(text: String, attr: Boolean, entities: Object): String
```
Encodes the specified string using named entities. The core entities will be encoded
as named ones but all non lower ascii characters will be encoded into named entities.

#### Parameters

- `text (String)` - Text to encode.
- `attr (Boolean)` - Optional flag to specify if the text is attribute contents.
- `entities (Object)` - Optional parameter with entities to use.

#### Return value

- `String` - Entity encoded text.

### encodeNumeric()

```javascript
encodeNumeric(text: String, attr: Boolean): String
```
Encodes the specified string using numeric entities. The core entities will be
encoded as named ones but all non lower ascii characters will be encoded into numeric entities.

#### Parameters

- `text (String)` - Text to encode.
- `attr (Boolean)` - Optional flag to specify if the text is attribute contents.

#### Return value

- `String` - Entity encoded text.

### encodeRaw()

```javascript
encodeRaw(text: String, attr: Boolean): String
```
Encodes the specified string using raw entities. This means only the required XML base entities will be encoded.

#### Parameters

- `text (String)` - Text to encode.
- `attr (Boolean)` - Optional flag to specify if the text is attribute contents.

#### Return value

- `String` - Entity encoded text.

### getEncodeFunc()

```javascript
getEncodeFunc(name: String, entities: String): Function
```
Returns an encode function based on the name(s) and it’s optional entities.

#### Parameters

- `name (String)` - Comma separated list of encoders for example named,numeric.
- `entities (String)` - Optional parameter with entities to use instead of the built in set.

#### Return value

- `Function` - Encode function to be used.
