几篇比较好的博客

古腾龙的博客:编码规则(UTF-8 GBK)

GBK 千千秀字

shell set

man ascii可以查看ascii码表,man utf-8看以查看utf-8的帮助

Unicode is a design,it includes all the characters on earth.It just defined the character set,just defined what characters should be included.It didn't define how to express these characters in computer.

UTF-8 is a implementation of Unicode.Its is designed in 1992 by Ken*Tompson(He and Riege created UNIX and C language together).

Unicode in java is 'char',2 bytes.From 0 to 0xffff.

But in UTF-8,different char has different bytes.

Unicode UTF-8 explanation
0000-007F 0xxx xxxx
0080-07FF 110xx xxx    10xx xxxx
0800-FFFF 1110 xxxx   10xx xxxx    10xx xxxx
   |  Unicode符号范围      |  UTF-8编码方式
 n |  (十六进制)           | (二进制)
---+-----------------------+------------------------------------------------------
  |   -  007F |                                              0xxxxxxx
  |   -  07FF |                                     110xxxxx 10xxxxxx
  |   -  FFFF |                            1110xxxx 10xxxxxx 10xxxxxx
  |   -  FFFF |                   11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
  |   - 03FF FFFF |          111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
  |   - 7FFF FFFF | 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

In java,'xxxxReader' is always text input and 'xxxxStream' is always a binary input.Firstly,We use text output 'PrintWriter' to write file.Then we use 'FileInputStream' to read file.Our task is to convert the binary information into Unicode.If what we write is the same with what we read,we can assure we comprehend the UTF-8 format.


 

we can use java's library to convert a gbk file to unicode.

class uni {
    public static void main(String[] args) throws Exception {
        String name=args[0].substring(0,args[0].indexOf("."));
        PrintWriter cout = new PrintWriter(new File(name + "-unicode.txt"));
        InputStreamReader cin = new InputStreamReader(new FileInputStream(
                new File(args[0])), "GBK");
        char buf[] = new char[100];
        int n = cin.read(buf);
        while (n != -1) {
            cout.print(buf);
            n = cin.read(buf);
        }
        cin.close();
        cout.close();
    }
}

UTF-8 's format的更多相关文章

  1. Unicode, UTF, ASCII, ANSI format differences

    Going down your list: "Unicode" isn't an encoding, although unfortunately, a lot of docume ...

  2. Unicode 与 UTF 字符标准

    Unicode 国际字符标准(UCS)是一个字符编码系统,它被设计用来支持世界各国不同语言书面文体之间的数据交换.处理以及显示.        Unicode用两个字节表示一个字符.前127个字符与A ...

  3. UCS UTF UTF-7 UTF-8 UTF-16

    Unicode也是一种字符编码方法,不过它是由国际组织设计,可以容纳全世界所有语言文字的编码方案.Unicode的学名是"Universal Multiple-Octet Coded Cha ...

  4. Delphi7中Unicode,ANSI,UTF编码问题

    注解: ANSI     'American Standard Code for Information Interchange' 美国信息互换标准代码 ANSI的'Ascii'编码 Unicode ...

  5. [转]程序员趣味读物:谈谈Unicode编码

    from : http://pcedu.pconline.com.cn/empolder/gj/other/0505/616631_all.html#content_page_1 这是一篇程序员写给程 ...

  6. Python中文乱码

    1,注意:请使用智慧型浏览器 "CHROME" 配合理解和运作本文中提到的程序. 2,提示:谷歌的CHROME浏览器是迄今为止最智慧的浏览器,没有之一,只有第一. 3,谷歌的CHR ...

  7. 关于几种编码详解(Unicode,UTF-8,GB系列)

    最近学Python,老是被编码的问题搞得晕乎乎的,晚上看了好多篇博客,整理出来一个比较清晰的关于几种编码以及字符集的思路. 主要参考:http://blog.sina.com.cn/s/blog_6d ...

  8. python chinese code

    http://blog.csdn.net/inte_sleeper/article/details/6676351 编码的历史 1.     ASCII ASCII(American Standard ...

  9. 编码Q&A

    Q:什么是编码? A:由于计算机中所有数据都是以二进制存在,那么为了存储数字,字母,各种符号和文字,计算机必须用一套映射系统来对应.比如我在某台计算机上规定,用00010001这个二进制数表示字母a, ...

  10. python的编码问题

    本文简单介绍了各种常用的字符编码的特点,并介绍了在python2.x中如何与编码问题作战 :) 请注意本文关于Python的内容仅适用于2.x,3.x中str和unicode有翻天覆地的变化,请查阅其 ...

随机推荐

  1. android Bitmap类方法属性 详细说明

    (转:http://blog.csdn.net/ymangu666/article/details/37729109) 1.  BitMap类public void recycle()——回收位图占用 ...

  2. web报表工具FineReport常用函数的用法总结(报表函数)

    说明:本次总结中,凡是以tableName或viewName作为参数因子的.函数在调用的时候均按照先从私有数据源中查找,然后再从公有数据源中查找的顺序. CLASS CLASS(object):返回o ...

  3. PS色调均化滤镜的快捷实现(C#源代码)。

    photoshop色调均化功能通常是在进行修片处理前期比较常用的功能之一,其对扩展图像的对比度,增强视觉效果有一定的作用.在很多课本或者文章中,也称这种处理为灰度均衡化.直方图均衡化等等.算法原理都是 ...

  4. Unity打包同一文件Hash不一样

    问题起因 游戏开发基本都会涉及到资源版本管理及更新,本文记录我在打包过程中遇到的一小问题: 开过中常用于标记资源版本的方法有计算文件Hash.VCS的版本等. 在Unity中对同一个资源文件进行多次打 ...

  5. ANE原生代码的调试(安卓)

    忙了一天终于有空继续这篇教程了. ANE的原生代码的调试其实在Adobe的官网有介绍的,但是同样很含糊,我摸索了一段时间现在记录下我的心得. 首先你得安装Eclipse,然后你得启动Eclipse 然 ...

  6. [技巧] 解决Win7下VMware中vmx86.sys报错的问题

    电梯直达 1楼 发表于 2012-7-2 15:14:22||倒序浏览|阅读模式 .pcb { margin-right: 0 } 当以普通用户权限运行的时候,VMware便会如此报错"无法 ...

  7. poj 2481

    Cows Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 16163   Accepted: 5380 Description ...

  8. git push时错误提示的解决办法 By default, updating the current branch in a non-bare repository error: is denied,

    在使用git将客户端的修改push到服务器上的时候,出现无法push,提示和stackoverflow上的http://stackoverflow.com/questions/2816369/git- ...

  9. phantomjs模拟登录

    最近在做一些公司其他部门系统的后台模拟操作,但由于那边的系统最开始是外包给其他公司开发的,现在那边的开发也不知道有些post的参数是如何生成的.于是想考察下是不是可以把phantomjs这个工具给加进 ...

  10. js删除数据的几种方法

    js 删除数组几种方法 var arr=['a','b','c']; 若要删除其中的'b',有两种方法: 1.delete方法:delete arr[1] 这种方式数组长度不变,此时arr[1]变为u ...