A. Terminal Chinese display garbled
Some netizens said to modify/var/lib/locales/supported.d/locale and/etc/default/locale It's all right, but if multiple people share a machine, there's no root authority. This is obviously undesirable. Now we recommend a change in your own host directory to handle the Chinese display garbled problem
vim ~/.bashrc
export LANG=zh_CN.UTF-8 export LC_CTYPE="zh_CN.UTF-8"
source ~/.bashrc
Terminal display garbled, solved.
Two. Vim Chinese display garbled
And the same as above. Modify the. vimrc file in the host directory to
- Vim ~/.VIMRC
set encoding=utf-8 "设置gvim内部编码 set fileencoding=utf-8 "设置当前文件编码 set fileencodings=ucs-bom,utf-8,gbk,cp936,latin-1 "设置支持打开的文件的编码
three. Link MySQL in the terminal sometimes it will show garbled
The general terminal can display the Chinese, after the connection MySQL display will be normal but also will appear garbled this time must set up
1. Use set names UTF8;
set names utf8;
2. Another way
‘character_set_%‘;查看校对规则系统变量:show variables like ‘collation_%‘;字符集系统变量介绍:character_set_server:默认的内部操作字符集character_set_client:客户端来源数据使用的字符集character_set_connection:连接层字符集character_set_results:查询结果字符集character_set_database:当前选中数据库的默认字符集character_set_system:系统元数据(字段名等)字符集
实现方式 1
my.cnf在[mysqld]下添加 default-character-set=utf8 在[client]下添加 default-character-set=utf8
Terminal and vim Chinese coding problem