EncodeURI/decodeURI: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Line 26: Line 26:
Encode a URI:
Encode a URI:
<pre>
<pre>
var uri = "my test.asp?name=st�le&car=saab";
var uri = "my test.asp?name=ståle&car=saab";
NSB.Print(encodeURI(uri));
NSB.Print(encodeURI(uri));
</pre>
</pre>

Revision as of 15:39, 3 May 2017

encodeURI(URI)

decodeURI(URI)

Description

The encodeURI() function is used to encode a URI.

This function encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters).

The decodeURI() function is used to decode a URI.

Example (Basic)

Encode a URI:

uri = "my test.asp?name=ståle&car=saab"
Print encodeURI(uri)

The result of res will be:

my%20test.asp?name=st%C3%A5le&car=saab

Example (JavaScript)

Encode a URI:

var uri = "my test.asp?name=ståle&car=saab";
NSB.Print(encodeURI(uri));

The result of res will be:

my%20test.asp?name=st%C3%A5le&car=saab

Related Items

escape, unescape, encodeURIComponent, decodeURIComponent