{"id":1195,"date":"2013-03-12T01:55:41","date_gmt":"2013-03-11T16:55:41","guid":{"rendered":"http:\/\/adreamer.godohosting.com\/?p=1195"},"modified":"2013-03-12T01:56:39","modified_gmt":"2013-03-11T16:56:39","slug":"java%ec%97%90%ec%84%9c-javascript%ec%9d%98-encodeuricomponent-%ea%b5%ac%ed%98%84%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"http:\/\/milkdrops.net\/index.php\/archives\/1195","title":{"rendered":"Java\uc5d0\uc11c Javascript\uc758 encodeURIComponent \uad6c\ud604\ud558\uae30"},"content":{"rendered":"<p>\uc790\ubc14\uc5d0\uc11c\ub294 <a href=\"http:\/\/developer.android.com\/reference\/java\/net\/URLEncoder.html\">URLEncoder<\/a>\ub97c \uc0ac\uc6a9\ud574\uc11c \uc778\ucf54\ub529\uc744 \ud560 \uc218 \uc788\ub294\ub370 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 encodeURIComponent\uc640 \uc0b4\uc9dd \ub2e4\ub974\ub2e4.<\/p>\n<p>Java\uc758 <a href=\"http:\/\/docs.oracle.com\/javase\/6\/docs\/api\/java\/net\/URLEncoder.html\">URLEncoder<\/a>:<\/p>\n<ul>\n<li>literal characters (regex representation):\u00a0<code>[-a-zA-Z0-9._*]<\/code><\/li>\n<li>the space character\u00a0<code>\" \"<\/code>\u00a0is converted into a plus sign\u00a0<code>\"+\"<\/code>.<\/li>\n<\/ul>\n<p>JavaScript\uc758 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/JavaScript\/Reference\/Global_Objects\/encodeURIComponent\">encodeURIComponent()<\/a>:<\/p>\n<ul>\n<li>literal characters (regex representation):\u00a0<code>[-a-zA-Z0-9._*~'()!]<\/code><\/li>\n<\/ul>\n<p>\uc989, <span style=\"text-decoration: underline;\">\uc790\ubc14<\/span>\uc5d0\uc11c\ub294 <strong>\ube48\uce78<\/strong>\uc744 &#8216;<code>+<\/code>&#8216;\ub85c \ubc14\uafb8\uace0 <span style=\"text-decoration: underline;\">\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8<\/span>\ub294 \ube48\uce78\uc744 &#8216;<code>%20<\/code>&#8216;\uc73c\ub85c \ubcc0\ud658,<br \/>\n\uadf8\ub9ac\uace0 <span style=\"text-decoration: underline;\">\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8<\/span>\uc5d0\uc11c\ub294 <strong>&#8216;<code>~'()!<\/code>&#8216;<\/strong>\uc744 \uadf8\ub300\ub85c \ub450\uc9c0\ub9cc<span style=\"text-decoration: underline;\"> \uc790\ubc14<\/span>\uc5d0\uc11c\ub294 \uac01\uac01 UTF-8 \uc778\ucf54\ub529\uc2dc\ud0a8\ub2e4.<\/p>\n<p>\uacb0\uad6d \ube48\uce78\uacfc ~'()!\uc744 \ubcc0\ud658\uc2dc\ud0a4\uba74 URLEncoder\uc758 \uacb0\uacfc\ub97c encodeURIComponent\uc758 \uacb0\uacfc\uc640 \ub3d9\uc77c\ud558\uac8c \ub9cc\ub4e4 \uc218 \uc788\ub2e4.<\/p>\n<p>&nbsp;<\/p>\n<pre lang=\"java\">\r\npublic static String encodeURIComponent(String s)\r\n  {\r\n    String result = null;\r\n\r\n    try\r\n    {\r\n      result = URLEncoder.encode(s, \"UTF-8\")\r\n                         .replaceAll(\"\\\\+\", \"%20\")\r\n                         .replaceAll(\"\\\\%21\", \"!\")\r\n                         .replaceAll(\"\\\\%27\", \"'\")\r\n                         .replaceAll(\"\\\\%28\", \"(\")\r\n                         .replaceAll(\"\\\\%29\", \")\")\r\n                         .replaceAll(\"\\\\%7E\", \"~\");\r\n    }\r\n\r\n    \/\/ This exception should never occur.\r\n    catch (UnsupportedEncodingException e)\r\n    {\r\n      result = s;\r\n    }\r\n\r\n    return result;\r\n  }  \r\n<\/pre>\n<p>\uc548\ub4dc\ub85c\uc774\ub4dc\uc5d0\uc11c \uac1c\ubc1c\ud55c \uc571\uacfc \uc11c\ubc84\uac04\uc758 \ud1b5\uc2e0\uc774 \uc81c\ub300\ub85c \uc548\ub418\uc5b4 \ud5e4\ub9f8\uc5c8\ub294\ub370 \ube48\uce78\uc774 \ub2e4\ub974\uac8c \ubcc0\ud658\ub418\ub294 \uac83\uc774 \ubb38\uc81c\uc600\ub2e4.<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/607176\/java-equivalent-to-javascripts-encodeuricomponent-that-produces-identical-outpu\">Java equivalent to JavaScript&#8217;s encodeURIComponent that produces identical output?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc790\ubc14\uc5d0\uc11c\ub294 URLEncoder\ub97c \uc0ac\uc6a9\ud574\uc11c \uc778\ucf54\ub529\uc744 \ud560 \uc218 \uc788\ub294\ub370 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\uc5d0\uc11c \uc0ac\uc6a9\ud558\ub294 encodeURIComponent\uc640 \uc0b4\uc9dd \ub2e4\ub974\ub2e4. Java\uc758 URLEncoder: literal characters (regex representation):\u00a0[-a-zA-Z0-9._*] the space character\u00a0&#8221; &#8221;\u00a0is converted into a plus sign\u00a0&#8220;+&#8221;. JavaScript\uc758 encodeURIComponent(): literal characters (regex representation):\u00a0[-a-zA-Z0-9._*~'()!] \uc989, \uc790\ubc14\uc5d0\uc11c\ub294 \ube48\uce78\uc744 &#8216;+&#8216;\ub85c \ubc14\uafb8\uace0 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub294 \ube48\uce78\uc744 &#8216;%20&#8216;\uc73c\ub85c \ubcc0\ud658, \uadf8\ub9ac\uace0 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\uc5d0\uc11c\ub294 &#8216;~'()!&#8216;\uc744 \uadf8\ub300\ub85c \ub450\uc9c0\ub9cc \uc790\ubc14\uc5d0\uc11c\ub294 \uac01\uac01 UTF-8 \uc778\ucf54\ub529\uc2dc\ud0a8\ub2e4. \uacb0\uad6d \ube48\uce78\uacfc ~'()!\uc744 \ubcc0\ud658\uc2dc\ud0a4\uba74 &hellip; <a href=\"http:\/\/milkdrops.net\/index.php\/archives\/1195\" class=\"more-link\"><span class=\"screen-reader-text\">Java\uc5d0\uc11c Javascript\uc758 encodeURIComponent \uad6c\ud604\ud558\uae30<\/span> \ub354\ubcf4\uae30 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11,17],"tags":[224,94,270,223,221,222],"class_list":["post-1195","post","type-post","status-publish","format-standard","hentry","category-tips","category-17","tag-uri","tag-url","tag-270","tag-223","tag-221","tag-222"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/posts\/1195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/comments?post=1195"}],"version-history":[{"count":3,"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/posts\/1195\/revisions"}],"predecessor-version":[{"id":1198,"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/posts\/1195\/revisions\/1198"}],"wp:attachment":[{"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/media?parent=1195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/categories?post=1195"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/milkdrops.net\/index.php\/wp-json\/wp\/v2\/tags?post=1195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}