Java

Java get 방식으로 파라메터 전송할때 encoding

바리새인 2025. 1. 11. 01:50
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class URLEncoderExample {
    public static void main(String[] args) {
        try {
            String value = "Hello World!";
            String encodedValue = URLEncoder.encode(value, StandardCharsets.UTF_8);
            System.out.println(encodedValue); // Output: Hello+World%21
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}