@@ -54,6 +54,18 @@ function calculateAndPopulate(input) {
5454 const b64_decoding = b64Decode ( input ) ;
5555 setElementContentById ( "b64d_out" , b64_decoding ) ;
5656
57+ const uri_encoding = uriEncode ( input ) ;
58+ setElementContentById ( "uri_encoded_out" , uri_encoding ) ;
59+
60+ const uri_component_encoding = uriEncodeComponent ( input ) ;
61+ setElementContentById ( "uri_component_encoded_out" , uri_component_encoding ) ;
62+
63+ const uri_decoding = uriDecode ( input ) ;
64+ setElementContentById ( "uri_decoded_out" , uri_decoding ) ;
65+
66+ const uri_component_decoding = uriDecodeComponent ( input ) ;
67+ setElementContentById ( "uri_component_decoded_out" , uri_component_decoding ) ;
68+
5769 // Add character table to DOM
5870 character_table . innerHTML = characterTable ( input ) ;
5971}
@@ -99,6 +111,30 @@ function b64Decode(input) {
99111 }
100112}
101113
114+ // URL encoding/decoding
115+ function uriEncodeComponent ( input ) {
116+ return encodeURIComponent ( input ) ;
117+ }
118+ function uriDecodeComponent ( input ) {
119+ try {
120+ return decodeURIComponent ( input ) ;
121+ } catch ( e ) {
122+ console . error ( e ) ;
123+ return "Incompatible string" ;
124+ }
125+ }
126+ function uriEncode ( input ) {
127+ return encodeURI ( input ) ;
128+ }
129+ function uriDecode ( input ) {
130+ try {
131+ return decodeURI ( input ) ;
132+ } catch ( e ) {
133+ console . error ( e ) ;
134+ return "Incompatible string" ;
135+ }
136+ }
137+
102138// Character table
103139function characterTable ( input ) {
104140 if ( precievedLength ( input ) > 512 ) {
0 commit comments