字符集

关键词:字符集 容器字符集 乱码 UTF8

物理环境配置字符集

更改字符集

cat << 'EOF' > /etc/locale.conf 
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
EOF
source /etc/locale.conf

cat << 'EOF' > /etc/environment 
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
EOF
source /etc/locale.conf

开机自启动生效字符集

cat << 'EOF' >> /etc/rc.d/rc.local
source /etc/locale.conf
EOF
chmod +x /etc/rc.d/rc.local
echo; echo; cat /etc/rc.d/rc.local

容器环境配置字符集

docker run --name stest -d \
-p 30022:22 \
--env TZ='Asia/Shanghai' \
--env LANG="en_US.UTF-8" \
--env LC_ALL="en_US.UTF-8" \
daocloud.io/library/centos:7.8.2003 tail -F /tmp/tmp.txt

csdn 110796720