例如:
http://localhost:8080/myyouxi/upload/example.jpg
当我下载图片时,它变成了:
http://localhost:8080/myyouxi/upload/%E6%9A%97%E5%A4%9C%E9%AA%91%E5%A3%AB.jpg
然后它指向HTTP Status 404 - /myyouxi/upload/%E6%9A%97%E5%A4%9C%E9%AA%91%E5%A3%AB .jpg
最佳答案
我认为那是因为您的连接器未配置为使用 UTF-8 对 URI 进行编码。确保 <Connector>
$CATALINA_HOME/conf/server.xml
中的条目有 URIEncoding
属性设置为 UTF-8
,例如:
<Connector protocol="HTTP/1.1" port="8080"
connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
关于url - Tomcat对URL中的中文进行加密,如何取消?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15426758/