# Module /codec/uri

Percent-encoding and application/x-www-form-urlencoded query-string serialization.

```tangu
(use /codec/uri)
```

## Functions & symbols

### decode-uri-component

`(decode-uri-component encoded) -> String`

Decodes percent-encoded `%XX` sequences back to UTF-8 text.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `encoded` | `String` | no | Percent-encoded string |

```tangu
(uri/decode-uri-component "hello%20world%21") ; -> "hello world!"
```

### encode-uri-component

`(encode-uri-component text) -> String`

Percent-encodes reserved characters for safe inclusion in URL path segments or query values.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `text` | `String` | no | Raw URI component text |

```tangu
(uri/encode-uri-component "hello world!") ; -> "hello%20world%21"
```

### to-urlencoded-string

`(to-urlencoded-string map) -> String`

Serializes a Map of parameters as an `application/x-www-form-urlencoded` string.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Map` | no | Key-value query parameters map |

```tangu
(uri/to-urlencoded-string {:page 2 :q "rust"})
```
