1、引用《可爱的python》的一句话:中文就是永远的痛!
文件保存要有编码要求;编辑器,浏览器有支持的编码要求,数据库的存储,显示有编码要求
……各种软件,各种中文编码有些乱,理一理
2、字符集:
GBK GB2312的扩展
GB2312 简体中文系统下,ANSI 编码标准代表 GB2312
Unicode UTF-8(其中的一种编码)
3、语言标志
CP936 CodePage 936 对应 GBK(详细见微软官方介绍)
CP65001 UTF-8 Unicode
zh_cn 不是编码,是语言标志
CP936 也是语言标志,而非编码标志
CP 一般常见于MS的 cmd 特别 MySQL 查看表数据乱码,可以使用相应的 set names gbk
4、编码转换:
linux 一般系统默认都安装了 iconv ,可以终端显示,也可以导出到另外一个文件
iconv -f encoding -t encoding inputfile
iconv -f GBK -t UTF-8 inputfile -o outputfile
GBK/GB2312 结果都一样,都可以显示正常
enca 软件,需要另行安装:
enca 实现文件编码分析判断
enca --list language 可以列出所支持的语言和相应字符集
enca -L zh(_cn) file便可以判断文件编码
enca -L zh_CN -x UTF-8 file 将文件编码转换为UTF-8编码
2024年1月08日 19:00
Pavzi.com provides all the news about Gadgets, the Economy, Technology, Business, Finance and many more. The main concept or our aim behind this website has been the will to provide resources with full information on each topic which can be accessed through the Internet. To ensure that every reader gets what is important and worthy about the topic they search and link to hear from us. pavzi.com Our site is a multiple Niche or category website which will ensure to provide information and resources on each and every topic. Some of the evergreen topics you will see on our website are Career, Job Recruitment, Educational, Technology, Reviews and others. We are targeting mostly so it is true that Tech, Finance, and Product Reviews. The only reason we have started this website is to make this site the need for your daily search use.