PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Characters allowed in an encoded URL
  • Special cases
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Encodes a URL with a sub-set of ASCII characters. This function is used to replace characters not allowed in a URL (accented characters, spaces, etc.). A URL can be decoded by URLDecode.
Remark: The syntax of the URL is not checked.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Encodes a URL
EncodedURL = URLEncode("http://my site/my page")
 
// EncodedURL now contains http://my%20site/my%20page
// The two spaces are converted to %20
Versions 22 and later
MyURL is UNICODE string = "http://my site/my page"
MyEncodedURL is string

// Encodes a URL
MyEncodedURL = URLEncode(MyURL, encodeURLFromUnicode)
New in version 22
MyURL is UNICODE string = "http://my site/my page"
MyEncodedURL is string

// Encodes a URL
MyEncodedURL = URLEncode(MyURL, encodeURLFromUnicode)
MyURL is UNICODE string = "http://my site/my page"
MyEncodedURL is string

// Encodes a URL
MyEncodedURL = URLEncode(MyURL, encodeURLFromUnicode)
Versions 22 and later
// Encode a URL with a URL parameter
Info(URLEncode("https://www.google.fr/?", encodeURLFromAnsi) + ...
URLEncode(URLEncode("https://www.google.fr/?é", encodeURLFromAnsi), encodeURLParameter))
New in version 22
// Encode a URL with a URL parameter
Info(URLEncode("https://www.google.fr/?", encodeURLFromAnsi) + ...
URLEncode(URLEncode("https://www.google.fr/?é", encodeURLFromAnsi), encodeURLParameter))
// Encode a URL with a URL parameter
Info(URLEncode("https://www.google.fr/?", encodeURLFromAnsi) + ...
URLEncode(URLEncode("https://www.google.fr/?é", encodeURLFromAnsi), encodeURLParameter))
Syntax
<Result> = URLEncode(<URL> [, <Encoding format>])
<Result>: Character string
Character string containing the encoded URL. Non-allowed characters are changed to %xx, where xx is the hexadecimal value of this character.
This function returns no error code because all character strings can be encoded.
<URL>: Character string (with quotes)
URL to be encoded (in ANSI format).
<Encoding format>: Optional Integer constant
Versions 22 and later
URL encoding format:
encodeURLFromAnsiURL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string.
encodeURLFromUTF8
(Default value)
URL format. The encoded text only contains characters allowed in a URL. The text to encode is a UTF-8 string.
encodeURLParameterURL format. The specific characters of a URL are encoded to pass a URL as a parameter to another URL.
Caution: The URL passed as parameter must have been encoded with the encodeURLFromAnsi or encodeURLFromUTF8 constant.

Java This parameter is not available.
New in version 22
URL encoding format:
encodeURLFromAnsiURL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string.
encodeURLFromUTF8
(Default value)
URL format. The encoded text only contains characters allowed in a URL. The text to encode is a UTF-8 string.
encodeURLParameterURL format. The specific characters of a URL are encoded to pass a URL as a parameter to another URL.
Caution: The URL passed as parameter must have been encoded with the encodeURLFromAnsi or encodeURLFromUTF8 constant.

Java This parameter is not available.
URL encoding format:
encodeURLFromAnsiURL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string.
encodeURLFromUTF8
(Default value)
URL format. The encoded text only contains characters allowed in a URL. The text to encode is a UTF-8 string.
encodeURLParameterURL format. The specific characters of a URL are encoded to pass a URL as a parameter to another URL.
Caution: The URL passed as parameter must have been encoded with the encodeURLFromAnsi or encodeURLFromUTF8 constant.

Java This parameter is not available.
Remarks

Characters allowed in an encoded URL

The list of characters allowed in an encoded URL is as follows:
;/?:@
&=+$,
-_.!~
*'(|)
%#digitsletters (uppercase and lowercase characters)

According to the options, the function will be able to encode some of these characters.

Special cases

  • Encoding an empty URL (empty string) returns an empty URL.
  • Special case: the "%" and "+" signs
    • Since the % sign is used for decimal encoding, it is itself encoded as a decimal.
    • The "+" sign, which is an alternative to %20 for encoding a space, is also encoded (to avoid problems when decoding).
Component: wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment