Tomcat 인코딩
1. Tomcat UTF-8 인코딩 문제
1) sever.xml 수정
apache-tomcat-9.0.52\conf\server.xml
에서 URIEncding="UTF-8"
속성을 추가한다.
1
2
3
4
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
1
2
3
4
5
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
redirectPort="8443"
URIEncoding="UTF-8" />
2) web.xml 수정
apache-tomcat-9.0.52\conf\web.xml
에서 encoding 필터를 추가한다.
1
2
3
4
5
6
7
8
9
10
11
12
13
<filter>
<filter-name>setCharacterEncodingFilter</filter-name>
<filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>setCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
[출처 및 참고]
This post is licensed under CC BY 4.0 by the author.