전자정부표준프레임워크/Exception 및 Error
json 데이타 출력시 한글이 깨지는 경우
yeon.Biju
2021. 2. 8. 15:43
json 으로 데이타를 출력할 때 한글이 깨질 수 있다.
그럴경우 produces="text/plain;charset=UTF-8" 부분을 추가해준다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
@RequestMapping(value="/jsonTest", produces="text/plain;charset=UTF-8")
@ResponseBody
public String jsonTest() throws Exception{
String result ="";
String msg ="";
String jsonString ="";
result ="한글출력도 OK";
msg ="English OK.";
jsonString = "{\"result\":\""+ result +"\",\"msg\":\""+ msg +"\"}";
return jsonString;
}
|
cs |