Method

# EncodeURLComponent

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Encodes the unsafe characters of a URL.

## Usage

``` xojo
result = EncodeURLComponent(str)
```

| Part   | Type                             | Description               |
|--------|----------------------------------|---------------------------|
| result | `String</api/data_types/string>` | The encoded string.       |
| str    | `String</api/data_types/string>` | The string to be encoded. |

## Notes

A valid URL consists of alphanumerics, special characters and some reserved characters. Use <span class="title-ref">EncodeURLComponent</span> to convert any unsafe characters so they can be properly used in a URL.

The reverse operation is done by `DecodeURLComponent</api/text/encoding_text/decodeurlcomponent>`.

## Sample code

Here is an example of how an embedded component separator is encoded.

``` xojo
Var s As String
s = EncodeURLComponent("www.bob&jane.com") 
' s is "www.bob%26jane.com"
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`DecodeURLComponent</api/text/encoding_text/decodeurlcomponent>`.

</div>
