본문 바로가기

Computer Science/Spring

[Spring] Get 호출시 response 에 한글 깨짐 현상

Spring boot GET 으로 호출시 response 값에 들어있는 한글이 깨지는 현상이 발생했었다.

 

아래와 같이 response 로 받은 값을 UTF-8로 인코딩을 해서 사용하니 문제가 해결되었다.

 

참고) httpGetConnection 은 내가 만든 메소드 이름이다.

 

HttpResponse response =  httpGetConnection("http://{URL}");
HttpEntity entity= response.getEntity();
String result = EntityUtils.toString(entity, "UTF-8");

 

반응형