encodeURIComponent(text) Last updated: 13. Nov 2023

Encodes a URI by replacing certain characters by escape sequences representing the UTF-8 encoding of the characters.

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.
#write(encodeURIComponent("https://testing.com?quotes=\"\""))#

Output

The #JS code above produces the output shown below:
https%3a%2f%2ftesting.com%3fquotes%3d%22%22