| 1 |
--- |
| 2 |
title: urls.PathEscape |
| 3 |
description: Returns the given string, applying percent-encoding to special characters and reserved delimiters so it can be safely used as a segment within a URL path. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: string |
| 9 |
signatures: [urls.PathEscape INPUT] |
| 10 |
--- |
| 11 |
|
| 12 |
{{< new-in v0.153.0 />}} |
| 13 |
|
| 14 |
The `urls.PathEscape` function does the inverse transformation of [`urls.PathUnescape`][]. |
| 15 |
|
| 16 |
```go-html-template |
| 17 |
{{ urls.PathEscape "my café" }} → my%20caf%C3%A9 |
| 18 |
``` |
| 19 |
|
| 20 |
Use this function to escape a string so that it can be safely used as an individual segment within a URL path. |
| 21 |
|
| 22 |
[`urls.PathUnescape`]: /functions/urls/PathUnescape/ |