file error / encoding
来源:互联网 发布:淘宝申请延长收货时间 编辑:程序博客网 时间:2024/06/05 00:17
*检测file是否遇到EOF
*返回0 没遇到结尾
*返回非0 file遇到结尾
ferror
*检测file目前是否有错误
*返回0 目前没有错误
*返回非0 有错误发生
clearerr
*reset error flag 以及EOF indicate
*没返回值
--------------------------------------------------------------
GB2312 ANSI DBCS 每个字1-2Bytes
Big5 ANSI DBCS 1-2Bytes
UTF-16 Unicode编码一种 UCS2 Wide Character 每个字2Bytes
UTF-8 Unicode编码一种 每个字1-6Bytes
---------------------------------------------------------------------------------------------------------------------
Double Byte Character System 有时专门指CJK
*有些字1Byte 有些字2Bytes
*第一个byte大于0x7F的话 后面的byte当成trail Byte
*例如 CE CC 31 32 33(翁123)
----------------------------------------------------------------------------------------------------------------------
UTF-8
每个字1-6Bytes 要看第一个Byte的8bit长相(开头有少个1 就有多少个车厢 包括自己在内)
*1: 0xxxxxxx
*2: 110xxxxx 10xxxxxx
*3: 1110xxxx 10xxxxxx 10xxxxxx
*4: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxxx
*5: 111110xx 10xxxxx 10xxxxxx 10xxxxxxx 10xxxxxxx
*6: 1111110x 10xxxxx 10xxxxxx 10xxxxxxx 10xxxxxxx 10xxxxxxx
--------------------------------------------------------------------------------------------------------------------
wchar_t 2bytes
wcscpy(s, L"123") 类比 strcpy()
wcslen(返回告诉有多少个字 不是Byte, 1word = 2bytes) strlen
--------------------------------------------------------------------------------------------
File开头的BOM(Byte order mark)
前三个bytes EF BB BF UTF-8
前两个bytes FF FE UCS2 big endian
前两个Bytes FE FF UCS2 litttle endian
没找到 DBCS
-----------------------------------------------------------------------------------
怎么知道是GB2312 还是Big 5
办不到 不许事先知道
CE CC 31 32 33 (GB2312) 翁123
CE CC 31 32 33 (Big5) 123
AF CE 31 32 33 在Big5 翁123
AF CE 31 32 33 GB2312 ??123
---------------------------------------------------------------------
UTF-8 跟 UCS2 one-on-one mapping
DBCS 转 UCS2 查表 library
DBCS 转 UTF-8 查表UCS2 在转UTF-8 / library
Linux下 iconv
iconv -f UTF-8 -t UTF-16LE input.txt -o output.txt
iconv -f gb2312 -t UTF-8 input.txt -o output.txt
iconv 提供command line 也提供library
UTF8 转GB2312 不保证成功 毕竟UTF-8里面各国文字
------------------------------------------------------------------------
Internationalization I18N
*软件设计符合国际化的标准
*基本上最好是One Binary run globally
Localization L10N
G11N
- file error / encoding
- Encoding-Decoding: file-encoding
- System.getProperty("file.encoding")
- file.encoding详解
- Python encoding error 解决方案
- 关于file.encoding的设置
- myecplise text-file-encoding设置
- 关于file.encoding的设置
- System property 之 file.encoding
- Tomcat 设置 Java File encoding
- Jboss 5/6 Reading/File Encoding Problem
- tomcat启动时候file.encoding的问题
- java中的file.encoding属性到底是什么?
- file was loaded in the wrong encoding
- tomcat启动时候file.encoding的问题
- How to use stringWithContentsOfURL:encoding:error:
- stringWithContentsOfURL:encoding:error方法返回nil
- maven error: unmappable character for encoding ASCII
- 从getSystemService()出发获取系统服务
- 第二十五节:父子、兄弟、相邻节点定位方式详解
- 使用Dom4j解析XML
- 电话号码问题
- java面向对象(三)之抽象类,接口
- file error / encoding
- iOS基础知识4
- C# 多线程(lock,Monitor,Mutex,同步事件和等待句柄)
- 自适应和响应式的区别
- GPL协议
- 从零开始学Scala系列(五)之集合2--Set和Map
- 重叠相加法&重叠保留法
- CSS基本语法 和 样式规则
- AsyncTask学习笔记