Download the file garbled problem solution (Java) with Chinese characters via JS jump URL

Source: Internet
Author: User

Problem Description:

Through the JS jump URL to download Chinese files, because the Chinese file name is garbled to find the file.

Solution:

After testing in Tomcat 8 and above this problem does not occur;

The following solutions Bo Master Pro-Test effective, if you have a better solution, please leave a message. Progress with each other.

If you are using TOMCAT7, add the following configuration in conf, Server.xml:

  

Uriencoding= "UTF-8"

Complete configuration:

<?XML version= "1.0" encoding= "UTF-8"?><!--Licensed to the Apache software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");  You are not a use of this file except in compliance with the License.  Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable or agreed to writing, software distributed under the License are distributed on a "as is" BASIS, without warranties  or CONDITIONS of any KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><!--note:a "Server" is not itself A "Container", so if you are not define subcomponents such as "valves" at the     . Documentation At/docs/config/server.html -<ServerPort= "8005"shutdown= "SHUTDOWN">  <ListenerClassName= "Org.apache.catalina.startup.VersionLoggerListener"/>  <!--Security Listener. Documentation at/docs/config/listeners.html <listener classname= "Org.apache.catalina.security.SecurityListener "/> -  <!--APR Library Loader. Documentation At/docs/apr.html -  <ListenerSslengine= "On"ClassName= "Org.apache.catalina.core.AprLifecycleListener"/>  <!--Initialize Jasper prior to WebApps is loaded. Documentation At/docs/jasper-howto.html -  <ListenerClassName= "Org.apache.catalina.core.JasperListener"/>  <!--Prevent memory leaks due to use of particular Java/javax APIs -  <ListenerClassName= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/>  <ListenerClassName= "Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>  <ListenerClassName= "Org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>  <!--Global JNDI Resources Documentation at/docs/jndi-resources-howto.html -  <globalnamingresources>    <!--Editable User database that can also is used by Userdatabaserealm to authenticate users -    <ResourceAuth= "Container"Description= "User database that can be updated and saved"Factory= "Org.apache.catalina.users.MemoryUserDatabaseFactory"name= "Userdatabase"Pathname= "Conf/tomcat-users.xml"type= "Org.apache.catalina.UserDatabase"/>  </globalnamingresources>  <!--a "service" is a collection of one or more "connectors", "that share A", "Container" note:a "service" is n       OT itself a "Container", so if not define subcomponents such as "valves" at the This level. Documentation At/docs/config/service.html -  <Servicename= "Catalina">    <!--The connectors can use a GKFX executor, you can define one or more named thread pools -    <!--<executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-" maxthreads= "4" minsparethreads=  -    <!--A "Connector" represents A endpoint by which requests is received and responses are returned. Documentation At:java HTTP Connector:/docs/config/http.html (Blocking & non-blocking) Java AJP Con  Nector:/docs/config/ajp.html APR (HTTP/AJP) Connector:/docs/apr.html Define a Non-ssl http/1.1 Connector On port 8080 -    <ConnectorConnectionTimeout= "20000"Port= "8080"Protocol= "http/1.1"Redirectport= "8443"/>    <!--A "Connector" using the shared thread pool -    <!--<connector executor= "Tomcatthreadpool" port= "8080" protocol= "http/1.1" Connectiont imeout= "20000" redirectport= "8443"/> -    <!--Define a SSL http/1.1 Connector on port 8443 This Connector uses the BIO implementation that requires the JSS E style configuration. When using the apr/native implementation, the OpenSSL style configuration is required as described in the Apr/nati ve documentation -    <!--<connector port= "8443" protocol= "Org.apache.coyote.http11.Http11Protocol" maxthreads= "Sslena" Bled= "true" scheme= "https" secure= "true" Clientauth= "false" sslprotocol= "TLS"/> -    <!--Define an AJP 1.3 Connector on port 8009 -    <ConnectorPort= "8009"Protocol= "ajp/1.3"Redirectport= "8443"/>    <!--An Engine represents, the entry point (within Catalina), that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes T         Hem on to the appropriate host (virtual host). Documentation At/docs/config/engine.html -    <!--should set Jvmroute to support load-balancing via AJP ie: <engine name= "Catalina" defaulthost= "localhost" Jvmroute= "JVM1" > -    <EngineDefaulthost= "localhost"name= "Catalina">      <!--for clustering, take a look at documentation at:/docs/cluster-howto.html docs/config/cluster.html (reference documentation) -      <!--<cluster classname= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/> -      <!--Use the Lockoutrealm to prevent attempts to guess user passwords via a brute-force attack -      <RealmClassName= "Org.apache.catalina.realm.LockOutRealm">        <!--This Realm uses the userdatabase configured in the global JNDI resources under the key "Userdatabase". Any edits that is performed against this userdatabase is immediately available for use by the Re  Alm.  -        <RealmClassName= "Org.apache.catalina.realm.UserDatabaseRealm"resourcename= "Userdatabase"/>      </Realm>      <HostAppBase= "WebApps"Autodeploy= "true"name= "localhost"Unpackwars= "true">        <!--Singlesignon valve, share authentication between Web applications documentation at:/docs/config/valve.h Tml -        <!--<valve classname= "Org.apache.catalina.authenticator.SingleSignOn"/> -        <!--Access Log processes all example. Documentation at:/docs/config/valve.html note:the pattern used are equivalent to using pattern= "common" -        <ValveClassName= "Org.apache.catalina.valves.AccessLogValve"Directory= "Logs"pattern= "%h%l%u%t &quot;%r&quot;%s%b"prefix= "Localhost_access_log."suffix= ". txt"/>      <ContextDocBase= "D:\apache-tomcat-7.0.82\webapps\platform"Path= "/platform"reloadable= "true"Source= "Org.eclipse.jst.jee.server:platform"/></Host>    </Engine>  </Service></Server>

Download the file garbled problem solution (Java) with Chinese characters via JS jump URL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.