---
schema_version: "1"
id: 07dce69355e628669f68b07c6c5f06ed18e5343c3e7a04dd4dd7a637e48e32f9
title: encodeURI
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-url-functions-encodeuri.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-url-functions-encodeuri
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 66643a8e04d24d6232135f4ae27395b701b8e54aed1bc766e588a4751207f092
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# encodeURI

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## encodeURI(text: String): String

Encodes a URI with UTF-8 escape sequences.

Applies up to four escape sequences for characters composed of two "surrogate" characters. The
function assumes that the URI is a complete URI, so it does not encode reserved characters that have
special meaning.

The function _does not encode these characters_ with UTF-8 escape sequences:

<table><colgroup><col> <col></colgroup><thead><tr><th>Type (not escaped)</th><th>Examples</th></tr></thead><tbody><tr><td><p>Reserved characters</p></td><td><p>; , / ? : @ &amp; = $</p></td></tr><tr><td><p>Unescaped characters</p></td><td><p>alphabetic, decimal digits, - _ . ! ~ * ' ( )</p></td></tr><tr><td><p>Number sign</p></td><td><p>#</p></td></tr></tbody></table>

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The URI to encode.</p></td></tr></tbody></table>

### Example

This example shows encodes spaces in one URL and lists some characters that do not get encoded in
the `not_encoded` string.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::URL
output application/json
---
{
    "encodeURI" : encodeURI("http://asd/ text to decode /%/\"\\/text"),
    "not_encoded": encodeURI("http://:;,/?:@&=\$_-_.!~*'()")
}
```

#### Output

```JSON
{
    "encodeURI": "http://asd/%20text%20to%20decode%20/%25/%22%5C/text",
    "not_encoded": "http://:;,/?:@&=$_-_.!~*'()"
}
```
