import java.io.UnsupportedEncodingException;
public class Encode_Decode {
public static void main(String[] args) {
String url = "test_[]입니다< > ()!#^$@%~&*";
try {
문자열 urlencode = java.net.URLEncoder.encode(url, "UTF-8");
System.out.println("인코딩: "+urlencode);
문자열 urldecode = java.net.URLDecoder.decode(urlencode, "UTF-8");
System.out.println("디코딩: "+urldecode);
} catch (UnsupportedEncodingException e) {
// TODO 자동 생성 catch block
e.printStackTrace();
}
}
}
코딩: this+is+a+test_%5B%5D%3C%3E%28%29%21%23%5E%24%40%25%7E%26*이 프로그램에서는 URLEncoder.encoder.encoder 메서드에서 String urlencode 변수를 인자로 전달한 후 결과를 출력합니다. 그런 다음 로 인코딩된 변수를 디코딩합니다. URLDecoder.decode 및 디코딩된 url.
디코딩: 이것은 test_[]입니다< > ()!#^$@%~&*
Please disable your ad blocker and refresh the window to use this website.