Languages
[Edit]
EN

JavaScript - safe ASCII characters in request parameters in URL

11 points
Created by:
Gigadude
791

In this short article we would like to show how to print all safe ASCII characters that we are able to use in request parameters in URL.

Runnable code:

// ONLINE-RUNNER:browser;

console.log('[NO]\t[CHAR]\t[BINARY]\n\n');

for (let i = 0, n = 0; i < 256; ++i) {
  	var char = String.fromCharCode(i);
  	var safeChar = encodeURIComponent(char);
  	if (char === safeChar) {
      	n += 1;
  		console.log(n + '\t' + char + '\t' + i.toString(2));
    }
}

Full list:

[NO]	[CHAR]	[BINARY]

1		!		100001
2		'		100111
3		(		101000
4		)		101001
5		*		101010
6		-		101101
7		.		101110
8		0		110000
9		1		110001
10		2		110010
11		3		110011
12		4		110100
13		5		110101
14		6		110110
15		7		110111
16		8		111000
17		9		111001
18		A		1000001
19		B		1000010
20		C		1000011
21		D		1000100
22		E		1000101
23		F		1000110
24		G		1000111
25		H		1001000
26		I		1001001
27		J		1001010
28		K		1001011
29		L		1001100
30		M		1001101
31		N		1001110
32		O		1001111
33		P		1010000
34		Q		1010001
35		R		1010010
36		S		1010011
37		T		1010100
38		U		1010101
39		V		1010110
40		W		1010111
41		X		1011000
42		Y		1011001
43		Z		1011010
44		_		1011111
45		a		1100001
46		b		1100010
47		c		1100011
48		d		1100100
49		e		1100101
50		f		1100110
51		g		1100111
52		h		1101000
53		i		1101001
54		j		1101010
55		k		1101011
56		l		1101100
57		m		1101101
58		n		1101110
59		o		1101111
60		p		1110000
61		q		1110001
62		r		1110010
63		s		1110011
64		t		1110100
65		u		1110101
66		v		1110110
67		w		1110111
68		x		1111000
69		y		1111001
70		z		1111010
71		~		1111110
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join