-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
408 lines (408 loc) · 16.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Url Encoder and Decoder</title>
<meta
name="description"
content="A simple web application to encode and decode URLs using Vite and TypeScript."
/>
<meta property="og:title" content="Url Encoder and Decoder" />
<meta
property="og:description"
content="A simple web application to encode and decode URLs using Vite and TypeScript."
/>
<meta
property="og:url"
content="https://url-encoder-decoder-two.vercel.app/"
/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link href="/dist/styles.css" rel="stylesheet" />
</head>
<body>
<main class="h-full w-full">
<header class="w-full p-4 shadow">
<div class="max-w-7xl mx-auto py-4 flex justify-start">
<a href="/" class="flex justify-center items-center gap-2.5">
<img
src="/icons/logo.png"
alt="Website Logo"
height="256"
width="256"
class="h-8 w-8 aspect-auto"
/>
<h1 class="text-base lg:text-xl font-semibold text-gray-800">
HOME
</h1></a
>
</div>
</header>
<section class="w-full p-4 lg:p-8">
<h1
class="w-full text-center text-xl lg:text-2xl xl:text-3xl font-bold text-gray-900"
>
URL Encoder/Decoder
</h1>
</section>
<section class="max-w-7xl w-full mx-auto p-4 lg:p-16">
<div class="my-4 lg:my-8 w-full flex gap-4">
<button
type="button"
id="encode-button"
class="p-1.5 lg:p-2.5 px-3 lg:px-6 cursor-pointer rounded bg-sky-600 hover:bg-sky-500 transition-all"
>
<span class="font-medium text-gray-100">Encode</span>
</button>
<button
type="button"
id="decode-button"
class="p-1.5 lg:p-2.5 px-3 lg:px-6 cursor-pointer rounded bg-sky-600 hover:bg-sky-500 transition-all"
>
<span class="font-medium text-gray-100">Decode</span>
</button>
<button
type="button"
id="copy-button"
class="p-1.5 lg:p-2.5 px-3 lg:px-6 cursor-pointer rounded bg-sky-600 hover:bg-sky-500 transition-all"
>
<span class="font-medium text-gray-100">Copy</span>
</button>
<button
type="button"
id="clear-button"
class="p-1.5 lg:p-2.5 px-3 lg:px-6 cursor-pointer rounded bg-sky-600 hover:bg-sky-500 transition-all"
>
<span class="font-medium text-gray-100">Clear</span>
</button>
</div>
<section class="w-full flex flex-col lg:flex-row gap-8 lg:gap-4">
<div class="w-full h-52 lg:h-96">
<textarea
name="input"
id="input"
cols="30"
rows="10"
autofocus
class="w-full h-full outline-none rounded p-2.5 text-base lg:text-lg shadow-lg resize-none text-gray-900"
placeholder="Enter your text here..."
></textarea>
</div>
<div class="w-full h-52 lg:h-96">
<textarea
name="output"
id="output"
cols="30"
rows="10"
class="w-full h-full outline-none rounded p-2.5 text-base lg:text-lg shadow-lg resize-none bg-gray-100 text-gray-900"
></textarea>
</div>
</section>
</section>
<section
class="max-w-7xl w-full mx-auto px-4 py-8 lg:py-16 xl:py-20 grid grid-flow-row lg:grid-flow-col gap-4 lg:gap-8"
>
<div class="flex flex-col gap-4 lg:gap-8">
<div class="w-full h-max">
<h1 class="font-bold text-xl lg:text-2xl text-gray-900">
About URL Encoder
</h1>
<p class="py-2.5 text-base lg:text-lg text-gray-800">
This is a simple web application to encode and decode URLs. You
need to type or paste a string in the input text area, the tool
will automatically convert your string to URL-encoded format in
real-time. Once the URL is encoded, you can click the copy button
to copy the encoded URL. To clear the input text area and output
text area click the clear button. Note that, our tool uses
<code class="p-0.5 rounded bg-slate-200">UTF-8</code> encoding
scheme for encoding URLs.
</p>
</div>
<div class="w-full h-max">
<h1 class="font-bold text-xl lg:text-2xl text-gray-900">
Why is URL Encoding Needed?
</h1>
<p class="py-2.5 text-base lg:text-lg text-gray-800">
URL encoding is necessary because URLs can only contain a limited
set of characters. If a URL includes special characters that are
not allowed or have reserved meanings, they must be encoded to
ensure the URL is safe, valid, and properly interpreted by web
browsers and servers.
</p>
<ol>
<li class="py-2.5 text-base lg:text-lg text-gray-800">
1. Certain characters have special meanings in URLs (e.g.,
<code>:</code>, <code>/</code>, <code>?</code>, <code>#</code>,
<code>&</code>, <code>=</code>, etc.). These are called reserved
characters and must be encoded if they are used for purposes
other than their special meaning.
</li>
<li class="py-2.5 text-base lg:text-lg text-gray-800">
2. Some characters are unsafe to include in a URL because they
can be misinterpreted or cause issues during transmission (e.g.,
<code>spaces</code>, <code><</code>, <code>></code>,
<code>"</code>, etc.).
</li>
<li class="py-2.5 text-base lg:text-lg text-gray-800">
3. Characters outside the ASCII set (e.g., accented letters,
Chinese characters, etc.) must be encoded.
</li>
</ol>
</div>
<div class="w-full h-max">
<h1 class="font-bold text-xl lg:text-2xl text-gray-900">
What is URL Encoding?
</h1>
<p class="py-2.5 text-base lg:text-lg text-gray-800">
URL encoding (also known as percent-encoding) is a way to convert
special characters in a URL into a format that can be safely
transmitted over the internet. It ensures that reserved and unsafe
characters do not interfere with the structure of a URL.
</p>
<h2 class="font-bold text-lg lg:text-xl text-gray-800">
Encoding Process:
</h2>
<p class="py-2.5 text-base lg:text-lg text-gray-800">
Each character to be encoded is replaced by a
<code>%</code> followed by its two-digit hexadecimal value.
</p>
<ul class="mx-4 my-2.5 lg:my-4 list-disc">
<li class="text-base lg:text-lg text-gray-800">
A space character (<code class="mx-0.5 bg-slate-100"></code>) is
encoded as <code class="mx-0.5 bg-slate-100">%20</code>.
</li>
<li class="text-base lg:text-lg text-gray-800">
The exclamation mark (!) is encoded as
<code class="mx-0.5 bg-slate-100">%21</code>.
</li>
<li class="text-base lg:text-lg text-gray-800">
The letter é (in UTF-8) is encoded as
<code class="mx-0.5 bg-slate-100">%C3%A9</code>.
</li>
</ul>
</div>
</div>
<div class="flex flex-col gap-4 lg:gap-8">
<div class="w-full h-max">
<h1 class="font-bold text-xl lg:text-2xl text-gray-900">
Common ASCII characters and their URL encoded value
</h1>
<div class="w-full my-4">
<table
class="w-full text-sm text-left rtl:text-right text-gray-500"
>
<thead class="text-xs text-gray-700 uppercase">
<tr>
<th scope="col" class="px-6 py-3 bg-gray-50">Character</th>
<th scope="col" class="px-6 py-3 bg-gray-100">
URL Encoding (UTF-8)
</th>
</tr>
</thead>
<tbody>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
space
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%20</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
"
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%22</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
`
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%60</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
,
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%2C</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
%
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%25</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
;
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%3B</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
:
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%3A</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
<
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%3C</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
>
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%3E</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
/
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%2F</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
=
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%3D</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
?
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%3F</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
@
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%40</code>
</td>
</tr>
<tr class="border-b border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
#
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%23</code>
</td>
</tr>
<tr class="border-gray-200">
<th
scope="row"
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap bg-gray-50"
>
&
</th>
<td
class="px-6 py-4 bg-gray-100 text-gray-900 whitespace-nowrap"
>
<code>%26</code>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
</main>
<script type="module" src="/src/main.ts"></script>
</body>
</html>