ArchTiger MYPI

ArchTiger
접속 : 3075   Lv. 51

Category

Profile

Counter

  • 오늘 : 19 명
  • 전체 : 10885 명
  • Mypi Ver. 0.3.1 β
[프로그래밍] Server characterset encoding (0) 2011/09/29 PM 04:21
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>

신고

 
X