Method

# DecodeURLComponent

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

## Description

Decodes the components of a URL that were encoded by `EncodeURLComponent</api/text/encoding_text/encodeurlcomponent>` or equivalent.

## Usage

``` xojo
result = DecodeURLComponent(str, enc)
```

| Part   | Type                                                 | Description                                                                                    |
|--------|------------------------------------------------------|------------------------------------------------------------------------------------------------|
| result | `String</api/data_types/string>`                     | The 'original' string.                                                                         |
| str    | `String</api/data_types/string>`                     | The encoded URL.                                                                               |
| enc    | `TextEncoding</api/text/encoding_text/textencoding>` | Optional: The `TextEncoding</api/text/encoding_text/textencoding>` to be used to decode *str*. |

## Notes

A valid URL consists of alphanumerics, special characters and some reserved characters. Use <span class="title-ref">DecodeURLComponent</span> to convert encoded characters back to their original values.

The optional text encoding parameter is used to specify the original encoding of the string. To specify the encoding, use the `Encodings</api/text/encoding_text/encodings>` module as shown in the second example.

## Sample code

Here are examples of how an encoded URL is decoded.

``` xojo
Var s As String
s = DecodeURLComponent("www.bob%26ray.com") ' returns "www.bob&ray.com"
s = DecodeURLComponent(TextField1.Text, Encodings.DOSArabic))
```

## Compatibility

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

<div class="seealso">

`Encodings</api/text/encoding_text/encodings>` module, `EncodeURLComponent</api/text/encoding_text/encodeurlcomponent>` function.

</div>
