zoukankan      html  css  js  c++  java
  • 系统字符编码

    CentOS-6

    1.查看编码信息

    [root@localhost ~]# echo $LANG
    en_US.UTF-8
    
    [root@localhost ~]# locale
    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    

    查看当前系统支持的字符集:

    [root@localhost ~]# locale -a
    

    2.临时修改

    [root@localhost ~]# LANG=en_US.UTF-8	# 基本用不到
    

    3.永久修改

    方法一:

    [root@localhost ~]# vim /etc/profile
    文件最后添加:export LANG='en_US.UTC'
    [root@localhost ~]# source /etc/profile
    [root@localhost ~]# echo $LANG
    en_US.UTC
    

    方法二:

    [root@localhost ~]# vim /etc/sysconfig/i18n
    [root@localhost ~]# cat /etc/sysconfig/i18n
    LANG="en_US.UTF-8"
    SYSFONT="latarcyrheb-sun16"
    [root@localhost ~]# source /etc/sysconfig/i18n
    [root@localhost ~]# echo $LANG
    en_US.UTF-8
    

    CentOS-7

    1.查看编码信息

    [root@localhost ~]# echo $LANG
    en_US.UTF-8
    
    [root@localhost ~]# locale
    LANG=zh_CN.UTF-8
    LC_CTYPE="zh_CN.UTF-8"
    LC_NUMERIC="zh_CN.UTF-8"
    LC_TIME="zh_CN.UTF-8"
    LC_COLLATE="zh_CN.UTF-8"
    LC_MONETARY="zh_CN.UTF-8"
    LC_MESSAGES="zh_CN.UTF-8"
    LC_PAPER="zh_CN.UTF-8"
    LC_NAME="zh_CN.UTF-8"
    LC_ADDRESS="zh_CN.UTF-8"
    LC_TELEPHONE="zh_CN.UTF-8"
    LC_MEASUREMENT="zh_CN.UTF-8"
    LC_IDENTIFICATION="zh_CN.UTF-8"
    LC_ALL=
    
    

    查看当前系统支持的字符集:

    [root@localhost ~]# locale -a
    

    2.临时修改

    [root@localhost ~]# LANG=en_US.UTF-8	# 基本用不到
    

    3.永久修改

    方法一:

    [root@localhost ~]# vim /etc/profile
    文件最后添加:export LANG='en_US.UTC'
    [root@localhost ~]# source /etc/profile
    [root@localhost ~]# echo $LANG
    en_US.UTC
    

    方法二:

    [root@localhost ~]# vim /etc/locale.conf
    [root@localhost ~]# cat /etc/locale.conf
    LANG="zh_CN.UTF-8"
    [root@localhost ~]# source /etc/locale.conf
    [root@localhost ~]# echo $LANG
    zh_CN.UTF-8
    

    方法三:

    [root@localhost ~]# localectl set-locale LANG=zh_CN.UTF-8
    
  • 相关阅读:
    19. vue的原理
    18.jwt加密
    17.vue移动端项目二
    16.vue-cli跨域,swiper,移动端项目
    15.vue动画& vuex
    14.vue路由&脚手架
    13.vue组件
    12.vue属性.监听.组件
    11.vue 数据交互
    从尾到头打印链表
  • 原文地址:https://www.cnblogs.com/os-linux/p/13896515.html
Copyright © 2011-2022 走看看