urlEncode(text) Last updated: 04. Mar 2025

Converts a string into a URL-encoded format, replacing unsafe characters with a percent sign followed by two hexadecimal digits representing the character's ASCII code.

Parameters

Name Type Description
text string Text to encode.

Returns

An encoded string.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#docly.urlEncode("1 2 3")#

Output

The #JS code above produces the output shown below:
1+2+3