EncodeURL

Converts special characters to hexadecimal encodings.

Syntax

LOADLIB "wh::system.whlib";

STRING FUNCTION EncodeURL(STRING text)

Parameters

STRING text

String to encode

Return value

STRING

The encoded string

Description

Certain characters have special significance in URLs, and should be represented by hexadecimal entities if they are to preserve their meanings. EncodeURL returns string with these conversions made.

The function is useful to prevent users from creating invalid URLs, for example in automatically generated TOCs.

Examples

// returns "this%20url%20will%20be%20encoded"
STRING example1 := EncodeURL("this url will be encoded");

// returns "The_rain.%20In%20Spain%2C%20Ma%92am"
STRING example2 := EncodeURL("The_rain. In Spain, Ma'am");