linux与windows字符编码格式的自动调整
来源:互联网 发布:数据保护线缠绕视频 编辑:程序博客网 时间:2024/06/07 15:16
这几天频繁在windows和ubuntu下调试代码,字符编码格式不同老是造成很大的困扰,windows下的默认字符编码格式是GBK(gb2312)而在ubuntu下的是utf-8。前天光来回的保存编码格式就费了很大的劲,今天google了下找到了个临时还算是不错的方法。
ubuntu下自带一个字符编码格式调整命令:iconv
ICONV(1) Debian GNU/Linux ICONV(1)NAME iconv - Convert encoding of given files from one encoding to anotherSYNOPSIS iconv -f encoding [-t encoding] [inputfile]...DESCRIPTION The iconv program converts the encoding of characters in inputfile, or from the standard input if no filename is specified, from one coded character set to another. The result is written to standard output unless otherwise specified by the --output option. --from-code, -f encoding Convert characters from encoding. --to-code, -t encoding Convert characters to encoding. If not specified the encoding corresponding to the current locale is used. --list, -l List known coded character sets. -c Omit invalid characters from output. --output, -o file Specify output file (instead of stdout). --silent, -s Suppress warnings, but not errors. --verbose Print progress information. --help, -? Give help list. --usage Give a short usage message. --version, -V Print program version.ENCODINGS The values permitted for --from-code and --to-code can be listed by the iconv --list command, and all combinations of the listed values are supported. Furthermore the following two suffixes are supported: //TRANSLIT When the string "//TRANSLIT" is appended to --to-code, transliteration is activated. This means that when a character cannot be represented in the target character set, it can be approximated through one or several similarly looking characters. //IGNORE When the string "//IGNORE" is appended to --to-code, characters that cannot be represented in the target character set will be silently discarded.AUTHOR iconv was written by Ulrich Drepper as part of the GNU C Library. This man page was written by Joel Klecker <espy@debian.org>, for the Debian GNU/Linux system.3rd Berkeley Distribution lenny ICONV(1)
通过上面的介绍估计大家就可以很好的理解了。
iconv -f gb2312 -t utf-8 a.txt > b.txt;
就可以将字符编码为gb2312的文件a.txt转换到编码格式为utf-8的b.txt文件。这样就可以在ubuntu下正常的查看了。希望可以帮到大家,自己也留底备用。
如果是在windows下,可以使用word来修改字符编码,但是比较麻烦,有一个小软件:convert比较好用,能批量式修改。大家可以搜一下。我也上传了一个到资源区,大家可以下载:http://download.csdn.net/detail/timebomb/3987420
- linux与windows字符编码格式的自动调整
- linux与windows字符编码格式的自动调整
- 字符的编码格式
- 字符与字节区别,编码格式的字符长度
- linux 字符编码格式
- C++ 与 字符编码格式
- C++ 与 字符编码格式
- 字符编码格式的显示与存储示例分析
- linux终端下字符编码格式转换
- Linux与Windows间的编码
- Linux与Windows间的编码
- java中自动判断字符编码的格式以及转码
- Windows 批处理文件的编码格式
- Windows 批处理文件的编码格式
- 字符编码和字符编码的保存格式
- Linux和Windows文件编码格式区别
- Linux/Windows 下字符编码转换
- 一个简单的字符编码格式过滤器
- SharePoint 2007图文开发教程 ---体验Event Handler
- Android横竖屏切换解决方案
- 程序员经典语录
- cocos2d-x 根据png序列图创建animation
- MOSS2007开发之旅——EventHandler
- linux与windows字符编码格式的自动调整
- 自定义标签使用中出现问题
- rails开发利器:简单的push服务器 faye
- ocr 相关网站
- struts2.1.6 action 01
- JSTL核心标签
- 被误解的C++
- 反编译 Android APK
- JQuery常用函数