After the Chinese name file is uploaded to the linux server, the file name will be garbled

To upload files to linux server, it needs to be changed to Chinese name

. Both system.out and logger.info can print Chinese name.

File tempFile = new File(path, fileName);

tempFile.createNewFile();

createNewFile always generates Chinese garbled files

and executes locale

root @iZ23126wcj7Z:/etc# locale

LANG=en_US.UTF-8

LANGUAGE=en_US:

LC_CTYPE="zh_CN.GBK"

LC_NUMERIC="zh_CN.GBK"

LC_TIME="zh_CN.GBK"

LC_COLLATE="zh_CN.GBK"

LC_MONETARY="zh_CN.GBK"

LC_MESSAGES="zh_CN.GBK"

LC_PAPER="zh_CN.GBK"

LC_NAME="zh_CN.GBK"

LC_ADDRESS="zh_CN.GBK"

LC_TELEPHONE="zh_CN.GBK"

LC_MEASUREMENT= "zh_CN.GBK"

LC_IDENTIFICATION="zh_CN.GBK"


LC_ALL=zh_CN.GBK

If LC_ALL= is empty or not zh_CN.GBK,
you can modify
vi /etc/sysconfig/i18n like this

默认为:
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

修改为:
LANG="zh_CN.GBK"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh"
SYSFONT="latarcyrheb-sun16"

方法2:
vi /etc/profile

export LC_ALL="zh_CN.GBK"
export LANG="zh_CN.GBK"

. /etc/profile 

 Restart the server, be sure to restart the server

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326483798&siteId=291194637