-
FEATURED COMPONENTS
First time here? Check out the FAQ!
how to configue the button for upload to support the Chinese character?
I use the button to upload file,but when the file name include Chinese character, after uploaded the file name changes to unrecognized character.
Is there a way to solve the problem?
it's more like a server config problem. i can get Chinese file name correctly when using Fileupload.
if you're using Tomcat, you need config server.xml and/or web.xml like the following
liu.yan@liuyan /cygdrive/c/tomcat7/conf
$ colordiff -u server.xml.original server.xml
--- server.xml.original 2011-11-20 19:38:06.000000000 +0800 +++ server.xml 2011-11-30 17:26:18.126500000 +0800 @@ -67,9 +67,10 @@ APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> - <Connector port="8080" protocol="HTTP/1.1" - connectionTimeout="20000" - redirectPort="8443" /> + <Connector port="8080" protocol="HTTP/1.1" + connectionTimeout="20000" + redirectPort="8443" URIEncoding='UTF-8' /> + <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" @@ -88,7 +89,7 @@ --> <!-- Define an AJP 1.3 Connector on port 8009 --> - <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> + <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding='UTF-8' /> <!-- An Engine represents the entry point (within Catalina) that processes
--- web.xml.original 2011-11-20 19:38:06.000000000 +0800 +++ web.xml 2011-11-30 17:26:30.579625000 +0800 @@ -347,6 +355,21 @@ --> + <!-- Example filter to set character encoding on each request --> + <filter> + <filter-name>Set Character Encoding</filter-name> + <filter-class>filters.SetCharacterEncodingFilter</filter-class> + <init-param> + <param-name>encoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + </filter> + <filter-mapping> + <filter-name>Set Character Encoding</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + </filter-mapping> + <!-- ================ Built In Servlet Mappings ========================= -->
Asked: 2011-12-02 03:15:18 +0800
Seen: 209 times
Last updated: Dec 08 '11