vi /etc/environment
修改编码
LC_ALL=zh_CN.UTF-8
LANG=zh_CN.UTF-8
保存退出(按esc 然后 :wq 回车)
使配置生效
source /etc/environment
查看
Locale
String encoding = System.getProperty("file.encoding");
FileUtil.writeFile(CommonConstants.FINISH_FILE_IMPORT_DIR, "encode-info.txt", "系统编码:" + encoding + "", false);
String vUrl = new String((dir + dto.getAttachmentUrl()).getBytes("UTF-8"),encoding);
File file = new File(vUrl);
if (!file.exists()) {
throw new Exception("该路径下【" + file + "】文件不存在,请检查");
}
用ftp拖拽上传文件时候设置