hello world

HttpClient Post로 전송시 한글 깨짐 현상 본문

WEB/error_log

HttpClient Post로 전송시 한글 깨짐 현상

sohyun_92 2020. 1. 3. 10:15
728x90

 

httpEntity에 json데이터 넣고 httpPost객체에 setEntity 해서 보내는 과정에서

HttpPost를 이용하여 한글 값을 전달시 한글 깨짐 현상을 발견했다. 

 

 

1.  request.addHeader("Content-Type", "application/json;charset=UTF-8");    

 

     ---> charset=UTF-8 을 추가했으나 해결되지 않음 

 

 

2. HttpEntity entity = new StringEntity(parameters.toString())   

 

   ---> HttpEntity entity = new StringEntity(param.toString(), "UTF-8");   :  해결 

 

 

   

   

Comments