{"id":29,"date":"2005-09-06T09:25:20","date_gmt":"2005-09-06T16:25:20","guid":{"rendered":"http:\/\/www.red-sweater.com\/blog\/?p=29"},"modified":"2005-09-06T09:54:43","modified_gmt":"2005-09-06T16:54:43","slug":"escape-from-all-code-trash","status":"publish","type":"post","link":"https:\/\/redsweater.com\/blog\/29\/escape-from-all-code-trash","title":{"rendered":"Escape from All Code Trash"},"content":{"rendered":"<p><a href=\"http:\/\/www.blooberry.com\/indexdot\/html\/topics\/urlencoding.htm\">URL Escaping<\/a> is what causes those yucky percent-signs and numeric digits to show up sometimes in the middle of your otherwise perfectly legible URLs. These percent-escaped values are necessary because the list of allowed characters for a URL doesn&#8217;t cover many of the common punctuation marks we like to use, and also fails to cover the Unicode characters that are more and more common in the international world-wide web.<\/p>\n<p>\nI was explaining to a client some of the finer details of escaping, and trying to foster an understanding for what needed to be escaped and what didn&#8217;t, when it occurred to me that they, like almost everybody reading this post, has at their disposal an excellent reference on URL Escaping: <b>the JavaScript interpreter built into their browser<\/b>.\n<\/p>\n<p>\nSince I discovered the built-in escaping and unescaping functions of JavaScript, I have from time to time taken advantage of them by typing something quickly into the address bar of Safari when I needed to get a quickly readable version:\n<\/p>\n<p>\njavascript:alert(unescape(&#8216;Escape%20from%20All%20Code%20Trash&#8217;))\n<\/p>\n<p>\nTo make this is as easy as possible for everyday users (my client, in this case) to take advantage of, I decided to put together a couple &#8220;button-bar&#8221; compatible JavaScript URLs. Now I keep these in my own toolbar for quickly encoding and decoding URL strings as necessary.\n<\/p>\n<p>\nTo try them out, just click on the link (from a web browser). To install them, drag them, one at a time, to your bookmarks bar.\n<\/p>\n<p><a href=\"javascript:var myStr=prompt('Please enter a string to escape:'); alert('Unescaped string: ' + myStr + '\\n\\n' + 'Escaped string: ' + escape(myStr));\">Escape URL<\/a><\/p>\n<p><a href=\"javascript:var myStr=prompt('Please enter a string to unescape:'); alert('Escaped string: ' + myStr + '\\n\\n' + 'Unescaped string: ' + unescape(myStr));\">Unescape URL<\/a><\/p>\n<p>\nI%20hope%20you%20enjoy%20these%20S%FCper%20Kewl%20Scripts%u2122%21, and please let me know if you have any suggestions for improving them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>URL Escaping is what causes those yucky percent-signs and numeric digits to show up sometimes in the middle of your otherwise perfectly legible URLs. These percent-escaped values are necessary because the list of allowed characters for a URL doesn&#8217;t cover many of the common punctuation marks we like to use, and also fails to cover [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-web"],"_links":{"self":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":0,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}