operating
- First make sure that your system is UTF encoded (my side is Alibaba Cloud centos server)
env|grep LANG
# 输出结果
# LANG=en_US.UTF-8
- After modifying
/etc/profile
the file
vi /etc/profile
i
# 添加下面的两行代码
export zh_CN.utf-8
export LANG=zh_CN.utf-8
- After logging in to the Alibaba Cloud website, restart the server
- Run the command line to view the server-side character set
locale
Modify the encoding format in the nginx configuration file
After the above steps are completed, you can
pass the public folder generated by hugo in windows to centos, and the garbled characters may need to be processed below.
View the default encoding of the windows operating system
On the Windows platform, enter the DOS window and enter: chcp
to get the code page information of the operating system. You can view the detailed character set information corresponding to the code page from the language option of the control panel.
E.g:
My activity code page is: 936, and the encoding format for it is GBK.
Convert GBK file name to UTF-8 encoding
The method is very simple, just modify the file name to utf8 encoding!
Install convmv, let him convert the code:
yum install convmv -y convmv -f GBK -t UTF8 -r --notest 目标路径
Where -f is the source encoding, -t is the target encoding, -r is the recursive processing directory, and -notest is not moving, and the file is actually renamed.