Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

encodeuricomponent js

var set1 = ";,/?:@&=+$";  // Reserved Characters
var set2 = "-_.!~*'()";   // Unescaped Characters
var set3 = "#";           // Number Sign
var set4 = "ABC abc 123"; // Alphanumeric Characters + Space

console.log(encodeURI(set1)); // ;,/?:@&=+$
console.log(encodeURI(set2)); // -_.!~*'()
console.log(encodeURI(set3)); // #
console.log(encodeURI(set4)); // ABC%20abc%20123 (the space gets encoded as %20)

console.log(encodeURIComponent(set1)); // %3B%2C%2F%3F%3A%40%26%3D%2B%24
console.log(encodeURIComponent(set2)); // -_.!~*'()
console.log(encodeURIComponent(set3)); // %23
console.log(encodeURIComponent(set4)); // ABC%20abc%20123 (the space gets encoded as %20)

Comment

encodeuricomponent reverse

  var result = decodeURIComponent(input);
Comment

encodeuricomponent

The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.
console.log(encodeURIComponent('?x=test'));
// expected output: "%3Fx%3Dtest"
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to print two arrays together 
Javascript :: jquery select2 multiple select all 
Javascript :: array -1 javascript 
Javascript :: service worker registration 
Javascript :: vue 3 custom input component 
Javascript :: database in javascript 
Javascript :: create a style in div jsx 
Javascript :: how to get value inside span using javascript 
Javascript :: paper js text example 
Javascript :: event property value in angular 
Javascript :: vue google map api for user marker location 
Javascript :: counter in html and js 
Javascript :: javascript days until end of month 
Javascript :: js json escape 
Javascript :: how to make an event listener only work once 
Javascript :: mongoose bulk update 
Javascript :: nested ternarys javascript 
Javascript :: parseint function javascript 
Javascript :: how to get the last element in javascript 
Javascript :: greater than x but less than y javascript 
Javascript :: map in react 
Javascript :: include hover in style jsx 
Javascript :: how to deploy firebase angular 10 
Javascript :: JavaScript array to URL params 
Javascript :: map method js 
Javascript :: execute shell command in javascript 
Javascript :: axios post request progress 
Javascript :: Add array to formData react js 
Javascript :: match regex 
Javascript :: js do...while 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =