logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtScript functions

urlencode

Render a string safe for use in an url

Syntax

[var $... = ]call urlencode $val=...[...] optional · ... your value

Notes

Returns a string in which all non-alphanumeric characters except -_.~
have been replaced with a % followed by two hex digits
Spaces are encoded as +
For spaces encoded as %20 use rawurlencode

Example

<!--parser:xtscript-->
var $input =! "£$%^&*+
var $output = call urlencode $val=$input
print input = $input<br />
print output = $output
<!--/parser:xtscript-->

Copy as text

Output reload

input = ! "£$%^&*+
output = %21+%22%C2%A3%24%25%5E%26%2A%2B

Related

urldecode rawurlencode rawurldecode

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top