티스토리 뷰


HttpPost를 이용해서 서버쪽으로 request를 날리면 한글이 (???) 이런 포멧으로 전달되는 현상을 발견했습니다.


확인을 해본 결과 request를 할때 Encoding 이 문제였음을 알 수 있었습니다.


json형식으로 parameter를 만들어서 이렇게 request를 보내고 있었는데.

//set json to StringEntity
StringEntity se = new StringEntity(json);

//set httpPost Entity
post.setEntity(se);



아래처럼 UTF-8인코딩 설정을 해주어 해결했습니다.

//set json to StringEntity
StringEntity se = new StringEntity(json,HTTP.UTF_8);

//set httpPost Entity
post.setEntity(se);


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함