Official Content

Encodes special characters included in a URL.

Syntax

urlEncode(CharacterExpression)

Where:

CharacterExpression
             Attribute, variable, constant, or character expression that contains/provides the URL to be encoded. It must be based on the Character, Varchar, or LongVarchar data type.

Type Returned:
Character

Scope

Generator: .NET, .NET Framework, Java

Description

URLs often contain special characters, such as spaces and punctuation marks, which have to be encoded for correct transmission over the Internet. This function takes a string representing a URL and encodes it according to the URL encoding standard. For example, spaces are converted to "%20", commas to "%2C", etc.

Sample

&OriginalUrl = "https://www.example.com/search?query=my search term"
&EncodedUrl = urlEncode(&OriginalUrl) //The returned value is "https%3A%2F%2Fwww.example.com%2Fsearch%3Fquery%3Dmy%20search%20term"

See Also

urlDecode function

   

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant