getClass().getClassLoader().getResource("/") 空格问题
ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要的真实路径,在此,调用了URLDecoder的decode方法进行解码,以便得到原始的中文及空格路径
Path = java.net.URLDecoder.decode(Path,"utf-8");?
发布时间: 2012-10-31 14:37:32 作者: rapoo
getClass().getClassLoader().getResource("/") 空格问题
ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要的真实路径,在此,调用了URLDecoder的decode方法进行解码,以便得到原始的中文及空格路径
Path = java.net.URLDecoder.decode(Path,"utf-8");?