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有翻天覆地的变化,请查阅其 ...
随机推荐
- su认证失败&文件夹里打开终端的方法&atom安装
很久没用笔记本上的ubuntu,用不顺手,比在公司调教了半年多的电脑差远了.一步一步来.先解决最不顺手的三件事 1.su认证失败. 新安装的ubuntu系统是无法切换到root账户的,得做一番修改 s ...
- 加快FineReport报表设计的几个心得体会
加快FineReport报表设计的几个心得体会 一.从远程服务器大批量取数进行表样设计时,最好按“列顺序”取一个“空的SQL语句”,这样可提高设计速度.否则每次设计时模板均要从远程读取数据,速度相当慢 ...
- finereport普通报表的移动端自适应方案
移动端报表呈现,首先要求的是页面随手机屏幕大小自动放缩(自适应),下面给出一个普通报表中的finereport移动端自适应方案,适用于finereport 7.1之前的版本. 首先,了解一下当前我们可 ...
- [转]学习Nop中Routes的使用
本文转自:http://www.cnblogs.com/miku/archive/2012/09/27/2706276.html 1. 映射路由 大型MVC项目为了扩展性,可维护性不能像一般项目在Gl ...
- 学习图像算法阶段性总结 (附一键修图Demo) 2016.04.19更新demo
今天特别感慨,自己从决定研究图像处理,势必要做出一键修图算法. 经历了,三个多月的书籍积累,三个多月的算法调整以及优化. 人是一种奇怪的动物,当你做不到的时候,你以为做到了,自己会感觉很爽,很有成就感 ...
- 详细说说 Google Test Certified 的各级——Level 1
转载请联系作者,谢谢! 当你作为初创企业或项目的唯一测试人员,一个人一杠枪,你如何开始测试的工作?你是作为一条孤狼,面对10个甚至更多的开发,努力的做一条龙服务(加班加到死):还是想从1到11的转变? ...
- 最小生成树POJ3522 Slim Span[kruskal]
Slim Span Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 7594 Accepted: 4029 Descrip ...
- 使用 Flash Builder 的 Apple iOS 开发过程
使用 Flash Builder 的 Apple iOS 开发过程 iOS 开发和部署过程概述 构建.调试或部署 iOS 应用程序前的准备工作 在测试.调试或安装 iOS 应用程序时选择的文件 将 ...
- 嵌入式Linux驱动学习之路(六)u-boot启动内核
内核启动是需要必要的启动参数.不能开机自动完全从0开始启动,需要uboot帮助内核实现重定位并提供参数. 首先,uboo会从Kernel分区中读取bootcmd环境变量,根据环境变量可自动启动. 分区 ...
- oracle round 函数,replace()函数
(1)如何使用 Oracle Round 函数 (四舍五入)描述 : 传回一个数值,该数值是按照指定的小数位元数进行四舍五入运算的结果.SELECT ROUND( number, [ decimal_ ...