-
Notifications
You must be signed in to change notification settings - Fork 47
/
url-encode-decode.html
213 lines (203 loc) · 8.43 KB
/
url-encode-decode.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
---
title: URL Encoder | Decoder Online | Developer Tools
layout: post
---
<html>
<head>
{% include common-meta %}
<title>{{ page.title }}</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta name="description" content="This is open source tool for programmers to escape or unescape a String value for HTML use." />
<meta name="keywords" content="online,tool,html,escape,unescape,encode,decode,web,opensource,http" /> {% include theme-css %} {% include ie-fixes %}
</head>
<body class="hold-transition skin-green sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
{% include theme-header %} {% include theme-sidebar %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="box box-info">
<div class="box-header with-border">
<h1 class="box-title">URL Encoder and Decoder</h1>
</div>
<!-- /.box-header -->
<!-- form start -->
<div class="box-body">
<form role="form">
<div class="form-group">
<textarea class="form-control" rows="20" placeholder="Copy/Paste text here to encode or decode" id="inputText" autofocus></textarea>
</div>
</form>
</div>
<!-- /.box-body -->
<div class="box-footer">
<div class="btn-group">
<button type="button" class="btn btn-success" id="encode"> Encode </button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-info" id="decode">Decode</button>
</div>
</div>
<!-- /.box-footer -->
</div>
</section>
<section class="content">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">About URL Encoder and Decoder Tool</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>This is a free online tool to encode and decode http URLs. You can copy/paste your desired URL in below text field and hit Encode or Decode button.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">What is URL Encoding or Escape URL?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>URL encoding (also called as URL escaping) is used to represent special meaning characters in a URL. e.g. forward slash has a special meaning in HTTP URL. But in case your data contains a forward slash (/) and you want to send it without confusing
the HTTP server then you need to send it as %2F instead of / . Simlarly there are many other special characters that cab used as part of HTTP URL format. Below sample list can give you a idea of what this means.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header">
<h3 class="box-title">URL Encoding Characters</h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<th>Character</th>
<th>URL Encoded Value</th>
</tr>
<tr>
<td>backspace</td>
<td>%08</td>
</tr>
<tr>
<td>space</td>
<td>%20</td>
</tr>
<tr>
<td>forward slash (/)</td>
<td>%2f</td>
</tr>
<tr>
<td>back slash (\)</td>
<td>%5c</td>
</tr>
<tr>
<td>@</td>
<td>%40</td>
</tr>
<tr>
<td>"</td>
<td>%22</td>
</tr>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Want To Know What Is The URL Encoded Value of a Character?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>That is easy. Just type the character or a full string in the text box above and hit Encode button. You should be able to see the encoded value.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">What is URL Decoding?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>URL decoding is the reverse process of encoding. This is used by the HTTP server to get the real data value from encoded string.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Can I Decode Everything Encoded?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>Yes, everything encoded must be easily decoded as long as you know the characters used for encoding. In general any encoding/decoding (including URL encoding/decoding) is reversible both ways. Below are some key relations to rememeber about
encoding and decoding.</p>
<ul>
<li>There is always a one to one mapping of encoding to decoding. </li>
<li>Anything encoded can be decoded and anything decoded can be encoded.</li>
</ul>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Is Encoding Secure?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>No, the purpose of encoding is not security. It is used for avoiding ambiguity. If you require security of data consider encryption after encoding.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Where Is URL Encoding and Decoding Used?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>URL encoding is used for transfer of data using HTTP protocol. This is very common in any HTTP interaction using get method call.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Is URL Encoding Same As JavaScript escape() function?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>Yes, URL encoding can be done in JavaScript using escape() function. This function is not deprecated since it has a misleading name. The community recomments to use <code>encodeURI()</code> or <code>encodeURIComponent()</code> instead. </p>
<p>This tool also uses JavaScript to do URL encoding. You can perform this encoding and decoding in any programming language.</p>
</div>
<!-- /.box-body -->
</div>
</section>
{% include addthis %}
</div>
<!-- /.content-wrapper -->
{% include theme-footer %}
</div>
<!-- ./wrapper -->
{% include theme-bottom-js %}
</body>
<script src="plugins/selectOnFocus/jquery.selectOnFocus.min.js"></script>
<script>
$(document).ready(function() {
$("#encode").click(function() {
var inputTextArea = $("#inputText");
console.log(inputTextArea.val());
inputTextArea.val(encodeURIComponent(inputTextArea.val()).replace(/'/g, "%27").replace(/"/g, "%22"));
});
$("#decode").click(function() {
var inputTextArea = $("#inputText");
console.log(inputTextArea.val());
inputTextArea.val(decodeURIComponent(inputTextArea.val().replace(/\+/g, " ")));
});
$("#inputText").selectOnFocus();
$('#string-utility-category').addClass('active');
});
</script>
</html>