ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / String functions
  • Characters allowed in an encoded URL
  • Special cases
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Encodes a URL with a sub-set of ASCII characters. This function replaces forbidden characters in a URL (accents, spaces, etc.).. A URL can be decoded by URLDecode.
Remark: The URL is not checked for syntactic validity.
Example
// Encode une URL
URLEncodée = URLEncode("http://mon site/ma page")
// URLEncodée contient maintenant http://mon%20site/ma%20page 
// Les deux espaces ont été transformés en %20
MonURL is string Unicode = "http://mon site/ma page"
MonURLEncodée is string
// Encode une URL
MonURLEncodée = URLEncode(MonURL, encodeURLFromUnicode)
// Encodage d'une URL avec un paramètre de type URL
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
URL to be encoded (in ANSI format).
<Encoding format>: Optional Integer constant
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.
Warning: You must first encode the URL passed in parameter with one of the constants encodeURLDepuisAnsi or encodeURLDepuisUTF8.

AndroidAndroid Widget JavaPHP This parameter is not available.
Remarks

Characters allowed in an encoded URL

The list of characters allowed in an encoded URL is as follows:
;/?:@
&=+$,
-_.!~
*'(|)
%#the figuresletters (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 % sign and the + sign
    • 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: wd300std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help