{"id":54,"date":"2006-01-13T11:36:42","date_gmt":"2006-01-13T16:36:42","guid":{"rendered":"http:\/\/www.juixe.com\/techknow\/?p=54"},"modified":"2006-01-13T11:36:42","modified_gmt":"2006-01-13T16:36:42","slug":"decode-java","status":"publish","type":"post","link":"http:\/\/juixe.com\/techknow\/index.php\/2006\/01\/13\/decode-java\/","title":{"rendered":"Decode Java"},"content":{"rendered":"<p>Sometimes when working on web applications you need to encode GET parameter values that are part of a URL.  Recently while working on a custom URL handler in Java I ran into a situation where I thought I had to encode part of the URL.  I didn&#8217;t have to go that route, to encode\/decode the custom URL, but this reminded me how to do that in Java.  If you need to encode  string value to be included in a URL use the URLEncoder as such:<\/p>\n<pre>\nString encoded = URLEncoder.encode(&quot;value: *(&#%&quot;);\n\/\/ encoded would equal to &quot;value%3A+*%28%26%23%25&quot;\n<\/pre>\n<p>If you notice spaces will be converted to plus signs and characters like the pound sign (#) will be converted to their hexadecimal value.  To decode a sting value you can use the URLDecoder&#8217;s decode(String) method.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes when working on web applications you need to encode GET parameter values that are part of a URL. Recently while working on a custom URL handler in Java I ran into a situation where I thought I had to encode part of the URL. I didn&#8217;t have to go that route, to encode\/decode the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[15,3],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p902K-S","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/54"}],"collection":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":0,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}