UTF-8 's format
几篇比较好的博客
古腾龙的博客:编码规则(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.
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的更多相关文章
- Unicode, UTF, ASCII, ANSI format differences
Going down your list: "Unicode" isn't an encoding, although unfortunately, a lot of docume ...
- Unicode 与 UTF 字符标准
Unicode 国际字符标准(UCS)是一个字符编码系统,它被设计用来支持世界各国不同语言书面文体之间的数据交换.处理以及显示. Unicode用两个字节表示一个字符.前127个字符与A ...
- UCS UTF UTF-7 UTF-8 UTF-16
Unicode也是一种字符编码方法,不过它是由国际组织设计,可以容纳全世界所有语言文字的编码方案.Unicode的学名是"Universal Multiple-Octet Coded Cha ...
- Delphi7中Unicode,ANSI,UTF编码问题
注解: ANSI 'American Standard Code for Information Interchange' 美国信息互换标准代码 ANSI的'Ascii'编码 Unicode ...
- [转]程序员趣味读物:谈谈Unicode编码
from : http://pcedu.pconline.com.cn/empolder/gj/other/0505/616631_all.html#content_page_1 这是一篇程序员写给程 ...
- Python中文乱码
1,注意:请使用智慧型浏览器 "CHROME" 配合理解和运作本文中提到的程序. 2,提示:谷歌的CHROME浏览器是迄今为止最智慧的浏览器,没有之一,只有第一. 3,谷歌的CHR ...
- 关于几种编码详解(Unicode,UTF-8,GB系列)
最近学Python,老是被编码的问题搞得晕乎乎的,晚上看了好多篇博客,整理出来一个比较清晰的关于几种编码以及字符集的思路. 主要参考:http://blog.sina.com.cn/s/blog_6d ...
- python chinese code
http://blog.csdn.net/inte_sleeper/article/details/6676351 编码的历史 1. ASCII ASCII(American Standard ...
- 编码Q&A
Q:什么是编码? A:由于计算机中所有数据都是以二进制存在,那么为了存储数字,字母,各种符号和文字,计算机必须用一套映射系统来对应.比如我在某台计算机上规定,用00010001这个二进制数表示字母a, ...
- python的编码问题
本文简单介绍了各种常用的字符编码的特点,并介绍了在python2.x中如何与编码问题作战 :) 请注意本文关于Python的内容仅适用于2.x,3.x中str和unicode有翻天覆地的变化,请查阅其 ...
随机推荐
- Linux IPC socket编程基础
头文件 #include<unistd.h> #include <sys/types.h> #include <sys/socket.h> #include< ...
- Python所有的错误都是从BaseException类派生的,常见的错误类型和继承关系
https://docs.python.org/2/library/exceptions.html#exception-hierarchy BaseException +-- SystemExit + ...
- IDEA使用(1)intellIJ idea 配置 svn
以前开发工具一直用的是Eclipse/MyEclipse,虽然早就听说过Idea而且也尝试用过几次, 说实话一开始使用idea真是很不习惯,不只是快捷键不同:比如项目和模块.服务器(如Tomcat)配 ...
- 【一周读书】All life is problem solving
书籍:<开放的智力> 采铜是我在知乎关注最早的大V之一,那时我脑里有一大堆疑惑和问题,是他的答案帮助我理清了思绪.我从他身上学习到对书籍的爱好,对思维方法的关注,对智慧的向往.读这本小集子 ...
- Codeforces Round #285 (Div.1 B & Div.2 D) Misha and Permutations Summation --二分+树状数组
题意:给出两个排列,求出每个排列在全排列的排行,相加,模上n!(全排列个数)得出一个数k,求出排行为k的排列. 解法:首先要得出定位方法,即知道某个排列是第几个排列.比如 (0, 1, 2), (0, ...
- [No000003]现代版三十六计,计计教你如何做人
<现代版三十六计,计计教你如何做人> …………………………………………………………………………………… 第1计施恩计 在人际交往中,见到给人帮忙的机会,要立马扑上去,像一只饥饿的松鼠扑向地 ...
- LinkedList子类与Queue接口
LinkedList表示的是一个链表的操作类.定义如下: public class LinkedList<E> extends AbstractSequentialList<E> ...
- Centos5.8下编译安装PHP5.4和memcached, phalcon, yaf, apc
安装GIT 需要先安装gcc-c++ (sudo yum install gcc-c++)sudo yum install gettext-devel expat-devel cpio perl op ...
- [转]PHP 下使用 ZeroMQ 和 protobuf
FROM : http://www.68idc.cn/help/makewebs/php/20150118175432.html 前言 这个记录总的来说分两部分: 搭建环境. 简单使用教程. 搭建环境 ...
- [转]Class 'Think\Log' not found
转自:http://www.thinkphp.cn/topic/26815.html 解决偶尔出现 Class 'Think\Log' not found 的奇葩问题(并非每次必现,偶尔删除缓存可以解 ...