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

# encodeURI

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

## encodeURI(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/\"\'/text",
   "not_encoded": "http://:;,/?:@&=$_-_.!~*'()"
}
```
