1. 변경 전 (한글 깨질 때)
URL url = new URL(address); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.setConnectTimeout(timeout); InputStreamReader in = new InputStreamReader((InputStream)uc.getContent());
2. 변경 후 (한글, 한자 안깨짐)
URL url = new URL(address); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.setConnectTimeout(timeout); InputStreamReader in = new InputStreamReader((InputStream)uc.getContent(), "UTF-8");
3. Springboot에서 한글 깨짐 해결 방법
하지만 본인은 해결되지 않음.
application.properties 에 다음 추가
# Charset of HTTP requests and responses. Added to the "Content-Type" header if not set explicitly. spring.http.encoding.charset=UTF-8 # Enable http encoding support. spring.http.encoding.enabled=true # Force the encoding to the configured charset on HTTP requests and responses. spring.http.encoding.force=true