PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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 the unauthorized characters in a URL (accented characters, spaces, ...). An encoded URL can be decoded by URLDecode.
Note: The syntax of the URL is not checked.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
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.
Versions 22 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 22
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
Example
// Encodes a URL
EncodedURL = URLEncode("http://my site/my page")

// EncodedURL now contains http://my%20site/my%20page
// The two spaces are transformed into %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. The unauthorized characters are changed into %xx where xx is the hexadecimal value of this character.
This function returns no error code because all the character strings can be encoded.
<URL>: Character string (with quotes)
URL to encode (in ANSI format). URL to encode.
<Encoding Format>: Optional Integer constant
Versions 22 and later
Format for encoding the URL:
encodeURLFromAnsiURL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string.
encodeURLFromUnicodeURL format. The encoded text only contains characters allowed in a URL. The text to encode is a Unicode 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 reserved characters of a URL are encoded in order to pass a URL in parameter to a URL.
Caution: The URL passed in parameter must have been encoded beforehand with one of the encodeURLFromAnsi, encodeURLFromUnicode or encodeURLFromUTF8 constants.

AndroidAndroid Widget JavaPHP This parameter is not available.
New in version 22
Format for encoding the URL:
encodeURLFromAnsiURL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string.
encodeURLFromUnicodeURL format. The encoded text only contains characters allowed in a URL. The text to encode is a Unicode 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 reserved characters of a URL are encoded in order to pass a URL in parameter to a URL.
Caution: The URL passed in parameter must have been encoded beforehand with one of the encodeURLFromAnsi, encodeURLFromUnicode or encodeURLFromUTF8 constants.

AndroidAndroid Widget JavaPHP This parameter is not available.
Format for encoding the URL:
encodeURLFromAnsiURL format. The encoded text only contains characters allowed in a URL. The text to encode is an ANSI string.
encodeURLFromUnicodeURL format. The encoded text only contains characters allowed in a URL. The text to encode is a Unicode 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 reserved characters of a URL are encoded in order to pass a URL in parameter to a URL.
Caution: The URL passed in parameter must have been encoded beforehand with one of the encodeURLFromAnsi, encodeURLFromUnicode or encodeURLFromUTF8 constants.

AndroidAndroid Widget JavaPHP This parameter is not available.
Remarks

Characters allowed in an encoded URL

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

According to the options, some of these characters can be encoded by the function.

Special cases

  • The encoding of an empty URL (empty string) is an empty URL.
  • Special case: the % sign and the + sign
    • The % sign being used for the decimal encoding, this character is encoded in decimal as well.
    • The "+" sign, which is an alternative to %20 for encoding a space, is also encoded (to avoid problems when decoding).
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment