在J2ME实现UTF-8转换为Unicode编码的方法UTF-8就是Unicode Transformation Format-8,是Unicode的一种变换编码格式。本文介绍了UTF-8转换为Unicode编码的方法,给出了在J2ME环境下的实现。
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法UTF
-8就是Unicode Transformation Format-8,是Unicode的一种变换编码格式。 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法UTF
-8 有以下特性: 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法UCS 字符 U
+0000 到 U+007F (ASCII) 被编码为字节 0x00 到 0x7F (ASCII 兼容). 这意味着只包含 7 位 ASCII 字符的文件在 ASCII 和 UTF-8 两种编码方式下是一样的. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法所有 
>U+007F 的 UCS 字符被编码为一个多个字节的串, 每个字节都有标记位集. 因此, ASCII 字节 (0x00-0x7F) 不可能作为任何其他字符的一部分. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法表示非 ASCII 字符的多字节串的第一个字节总是在 
0xC0 到 0xFD 的范围里, 并指出这个字符包含多少个字节. 多字节串的其余字节都在 0x80 到 0xBF 范围里. 这使得重新同步非常容易, 并使编码无国界, 且很少受丢失字节的影响. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法可以编入所有可能的 231个 UCS 代码 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法UTF
-8 编码字符理论上可以最多到 6 个字节长, 然而 16 位 BMP 字符最多只用到 3 字节长. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法Bigendian UCS
-4 字节串的排列顺序是预定的. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法字节 
0xFE 和 0xFF 在 UTF-8 编码中从未用到. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法下列字节串用来表示一个字符. 用到哪个串取决于该字符在 Unicode 中的序号. 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法U
-00000000 - U-0000007F: 
在J2ME实现UTF-8转换为Unicode编码的方法 0xxxxxxx 
在J2ME实现UTF-8转换为Unicode编码的方法 
在J2ME实现UTF-8转换为Unicode编码的方法U
-00000080 - U-000007FF: 
在J2ME实现UTF-8转换为Unicode编码的方法 110xxxxx 10xxxxxx 
在J2ME实现UTF-8转换为Unicode编码的方法 
在J2ME实现UTF-8转换为Unicode编码的方法U
-00000800 - U-0000FFFF: 
在J2ME实现UTF-8转换为Unicode编码的方法 1110xxxx 10xxxxxx 10xxxxxx 
在J2ME实现UTF-8转换为Unicode编码的方法 
在J2ME实现UTF-8转换为Unicode编码的方法U
-00010000 - U-001FFFFF: 
在J2ME实现UTF-8转换为Unicode编码的方法 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 
在J2ME实现UTF-8转换为Unicode编码的方法 
在J2ME实现UTF-8转换为Unicode编码的方法U
-00200000 - U-03FFFFFF: 
在J2ME实现UTF-8转换为Unicode编码的方法 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 
在J2ME实现UTF-8转换为Unicode编码的方法 
在J2ME实现UTF-8转换为Unicode编码的方法U
-04000000 - U-7FFFFFFF: 
在J2ME实现UTF-8转换为Unicode编码的方法 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 
在J2ME实现UTF-8转换为Unicode编码的方法 
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法从上表还可以看出,UTF
-8每个编码字符都不可能以“10”开头,“10”是以连接符的形式出现在后面的编码字节开头。因此UTF-8编码在存储和传输时是不容易出错的。
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法下面是UTF
-8到Unicode的编码转换代码(J2ME环境下的实现):UTFC2UniC方法包含了编码转换逻辑。
在J2ME实现UTF-8转换为Unicode编码的方法
在J2ME实现UTF-8转换为Unicode编码的方法

相关文章:

  • 2021-08-18
  • 2021-08-20
  • 2021-07-12
  • 2022-01-26
  • 2021-06-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
  • 2021-10-11
  • 2022-02-11
  • 2021-08-12
  • 2021-06-17
相关资源
相似解决方案