자바에서 URL디코딩은 어떻게 하나요?
java
url-encoding
자바에서
https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type
이런 코드를
https://mywebsite/docs/english/site/mybook.do&request_type
이렇게 바꾸고 싶은데요.
class StringUTF
{
public static void main(String[] args)
{
try{
String url =
"https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do" +
"%3Frequest_type%3D%26type%3Dprivate";
System.out.println(url+"Hello World!------->" +
new String(url.getBytes("UTF-8"),"ASCII"));
}
catch(Exception E){
}
}
}
이런식으로 해봤는데 제대로 동작하지 않습니다. 어떻게 하면 좋을까요?
-
2016년 02월 04일에 작성됨
출처 : https://stackoverflow.com/questions/6138127/how-to-do-url-decoding-in-java 이 질문은 저작자표시-동일조건변경허락(https://creativecommons.org/licenses/by-sa/3.0/deed.ko) 라이센스로 이용할 수 있습니다. 윤동길 2018.3.27 13:40