• [프로그래밍] Server characterset encoding2011.09.29 PM 04:21

게시물 주소 FONT글자 작게하기 글자 키우기

URL strings in "GET" method must be encoded
use java.net.URLEncoder class
- space character replaced by '+'
- other multi bytes characters will be encoded hexa decimal characters

tips-> source url string should be "utf-8" encoded. even if you are using UNICODE

If you service openAPI and has "GET" methods you must handle the url encoding
insert the URLEncoding attribute in Connector elements in tomcat's server.xml

URIEncoding="UTF-8"/>

also if you use spring framework add this in web.xml
web.xml location is [Your project]/WebContent/WEB-INF/web.xml



<filter>
  <filter-name>encodingFilter</filter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
 <init-param>
  <param-name>encoding</param-name>
  <param-value>UTF-8</param-value>
 </init-param>
 <init-param>
  <param-name>forceEncoding</param-name>
  <param-value>true</param-value>
 </init-param>
</filter>
<filter-mapping>
 <filter-name>encodingFilter</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>

댓글 : 0 개
친구글 비밀글 댓글 쓰기