EncodeURI/decodeURI: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
 
(5 intermediate revisions by 2 users not shown)
Line 9: Line 9:
This function encodes special characters, except: , / ? : @ & = + $ # (Use [[encodeURIComponent]]() to encode these characters).
This function encodes special characters, except: , / ? : @ & = + $ # (Use [[encodeURIComponent]]() to encode these characters).


unEscape converts a string with special characters turned into a normal string.
The decodeURI() function is used to decode a URI.


== Example (Basic) ==
== Example ==


Encode a URI:
<tabber>
<pre>
JavaScript=
uri = "my test.asp?name=st�le&car=saab"
<syntaxhighlight lang="JavaScript">
// Encode a URI:
var uri = "my test.asp?name=ståle&car=saab";
NSB.Print(encodeURI(uri));
</syntaxhighlight>
|-|
BASIC=
<syntaxhighlight lang="vb.net">
' Encode a URI:
uri = "my test.asp?name=ståle&car=saab"
Print encodeURI(uri)
Print encodeURI(uri)
</pre>
</pre>
The result of res will be:
</syntaxhighlight>
<pre>
</tabber>
my%20test.asp?name=st%C3%A5le&car=saab
</pre>


== Example (JavaScript) ==
The result will be:
Encode a URI:
<pre>
var uri = "my test.asp?name=st�le&car=saab";
NSB.Print(encodeURI(uri));
</pre>
The result of res will be:
<pre>
<pre>
my%20test.asp?name=st%C3%A5le&car=saab
my%20test.asp?name=st%C3%A5le&car=saab
Line 36: Line 37:
== Related Items ==
== Related Items ==


[[encodeURI/decodeURI|encodeURI]], [[encodeURI/decodeURI|decodeURI]], [[encodeURIComponent/decodeURIComponent|encodeURIComponent]], [[encodeURIComponent/decodeURIComponent|decodeURIComponent]]
[[escape/unEscape|escape]], [[escape/unEscape|unescape]], [[encodeURIComponent/decodeURIComponent|encodeURIComponent]], [[encodeURIComponent/decodeURIComponent|decodeURIComponent]]


[[Category:Language Reference]]
[[Category:Language Reference]]


[[Category:Variable Handling]]
[[Category:Variable Handling]]

Latest revision as of 14:14, 24 July 2019

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

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

' Encode a URI:
uri = "my test.asp?name=ståle&car=saab"
Print encodeURI(uri)
</pre>

The result will be:

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

Related Items

escape, unescape, encodeURIComponent, decodeURIComponent