# EscapeURL

> Escapes characters in a string to ensure they are URL-friendly.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Networking](/engine/6000.3/script-reference/unityengine/networking.md)
* **Assembly:** UnityEngine.UnityWebRequestModule

## EscapeURL(string)

Escapes characters in a string to ensure they are URL-friendly.

```csharp
public static string EscapeURL(string s)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A string with characters to be escaped.

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Remarks

Certain text characters have special meanings when present in URLs. If you need to include those characters in URL parameters then you must represent them with escape sequences. It is recommended that you use this function on any text supplied by a user before passing the text as a URL parameter. This will ensure that a malicious user can't manipulate the contents of the URL to attack the webserver. See Also: [UnityWebRequest.UnEscapeURL](/engine/6000.3/script-reference/unityengine/networking/unitywebrequest/unescapeurl.md).

### Examples

```csharp
using UnityEngine;
using UnityEngine.Networking;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        string escName = UnityWebRequest.EscapeURL("Fish & Chips");
    }
}
```

## EscapeURL(string, Encoding)

Escapes characters in a string to ensure they are URL-friendly.

```csharp
public static string EscapeURL(string s, Encoding e)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A string with characters to be escaped.**** (\[Encoding]\(https\://learn.microsoft.com/dotnet/api/system.text.encoding)): The text encoding to use.

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Remarks

Certain text characters have special meanings when present in URLs. If you need to include those characters in URL parameters then you must represent them with escape sequences. It is recommended that you use this function on any text supplied by a user before passing the text as a URL parameter. This will ensure that a malicious user can't manipulate the contents of the URL to attack the webserver. See Also: [UnityWebRequest.UnEscapeURL](/engine/6000.3/script-reference/unityengine/networking/unitywebrequest/unescapeurl.md).

### Examples

```csharp
using UnityEngine;
using UnityEngine.Networking;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        string escName = UnityWebRequest.EscapeURL("Fish & Chips");
    }
}
```
