当前位置: 代码迷 >> J2SE >> http://localhost:8080/article/UserFiles/File/林三0(1).doc 不能打开?该怎么解决
  详细解决方案

http://localhost:8080/article/UserFiles/File/林三0(1).doc 不能打开?该怎么解决

热度:247   发布时间:2016-04-24 14:31:51.0
http://localhost:8080/article/UserFiles/File/林三0(1).doc 不能打开?
就是当在地址栏中输入:
http://localhost:8080/article/UserFiles/File/林三0(1).doc
时会出现
type   Status   report

message   /article/UserFiles/File/%E6%9E%97%E4%B8%890(1).doc

description   The   requested   resource   (/article/UserFiles/File/%E6%9E%97%E4%B8%890(1).doc)   is   not   available.

===请问怎样解决?
英文文件名是正常的,

------解决方案--------------------
中文文件名需要经过escape
如果服务端没有经过编码的一些处理,输入的url不能带这些字符。
------解决方案--------------------
只是连接里的内容用编码,像 "林三0(1) ",可以用javascript的encodeURIComponent
好象服务器也要设置一下java的request.setCharacterEncoding( "UTF-8 ")
  相关解决方案