yoni
인코딩시 특수문자 에러(제거된) 본문
이건 우선적으로 인코딩의 한계라고 볼 수 있다.
json입힘 -> BASE64Encoder -> UTF-8 encoding(response쪽에서 원하는 인코딩 타입 맞춰주기)
단)post 타입의 http통신은 기본적으로 인코딩을 해서 보내게 된다.
if ("POST".equals(strMethod))
{
postMethod = new PostMethod(strUrl);
if (contentType == null)
{
postMethod.addRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=" + encoding);
String jsonString = new GsonBuilder().disableHtmlEscaping().create().toJson(paramMap);
BASE64Encoder base64encode = new BASE64Encoder();
String suitJson = "data=" + base64encode.encode(jsonString.getBytes());
logger.info(LP.NOTE, "[dataJson]===============>"+suitJson);
postMethod.setRequestBody(suitJson);
//test code
System.out.println(suitJson);
}
httpMethod = (HttpMethod) postMethod;
}
참고 url
'코딩' 카테고리의 다른 글
rest-api 로직 파일을 하나 추가시 참고해야할 사항 (0) | 2019.12.11 |
---|---|
서버 운영 관계 및 개발 자료들 (0) | 2018.11.30 |
$$로 받기 때문에 인젝션 공격이 됨 (0) | 2018.07.31 |
SELECT 원하는 날짜 조회 하기 혹은 오늘날짜 조회 (0) | 2018.07.30 |
오라클 (0) | 2018.07.30 |
Comments