只要路径带中文就不加载怎么解决,我用的是UTF-8.....
使用英文目录。
为什么一定要用中文目录?
utf-8是万国码,全球通用。
eclipse规定不能用中文路径,但可以用中文包,类
先检查你的项目是不是在workspace内,再倒入项目才能运行项目
不能使用中文路径,eclipse会无法解析
前端接收到目录后用base64加密 后台接受到之后在用base64解密
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public final class BASE64Util {
/**
* 采用BASE64算法对字符串进行加密
* @param base 原字符串
* @return 加密后的字符串
*/
public static final String encode(String base){
return BASE64Util.encode(base.getBytes());
}
/**
* 采用BASE64算法对字节数组进行加密
* @param baseBuff 原字节数组
* @return 加密后的字符串
*/
public static final String encode(byte[] baseBuff){
return new BASE64Encoder().encode(baseBuff);
}
/**
* 字符串解密,采用BASE64的算法
* @param encoder 需要解密的字符串
* @return 解密后的字符串
*/
public static final String decode(String encoder){
try {
BASE64Decoder decoder = new BASE64Decoder();
byte[] buf = decoder.decodeBuffer(encoder);
return new String(buf);
} catch (Exception e) {
return null;
}
}
public static void main(String[] args) {
String s = "D:/系统/桌面/xxx.xxx";
String encode = encode(s.getBytes());
System.out.println(encode);
String decode = decode(encode);
System.out.println(decode);
}
}