encodeURIComponent

Prev Next

See also: decodeURIComponent

Encodes special characters and URI format characters with appropriate wildcards so that a text can be transmitted securely as part of a URL.For example, a space becomes '%20', a colon becomes '%3A', an ampersand becomes '%26', etc.

Tooltip

Syntax: $encodeURIComponent(text)

Parameter

Description

text

The text with which the URI will be securely encoded

Example:$encodeURIComponent(This text is URI secure & can be used in a URL!)Delivers 'This%20text%20is%20URI%20secure%20%26%20and%20can%20be%20%used%20in%20a%20URL!'

Syntax

$encodeURIComponent(text)

Parameter

Name

Description

text

The text with which the URI will be securely encoded.

Return value

The coded text.

Example

Syntax

Result

http://anydomain.com/?p=$encodeURIComponent(This text is URI secure? Yes: Because it is encoded accordingly!)

http://anydomain.com/?p=Dieser%20Text%20ist%20URI%20sicher%3F%20Ja%3A%20Weil%20er%20entsprechend%20kodiert%20wird!