开发学院手机开发Symbian 开发 Symbian中的一些编码转换API 阅读


 2010-08-31 00:13:00 来源:WEB开发网   
核心提示:前言:在Symbian中的中文字都是用unicode编码来完成的 ,所以通过功能函数转换为uncode或者保存为unicode文件就可以解决中文显示的问题了,Symbian中的一些编码转换API,以下是Symbian中提供的几个关于编码格式转换的API接口和粗略说明 ( 以功能逐渐强大为序 ):1) Class Esc

前言:在Symbian中的中文字都是用unicode编码来完成的 ,所以通过功能函数转换为uncode或者保存为unicode文件就可以解决中文显示的问题了。

以下是Symbian中提供的几个关于编码格式转换的API接口和粗略说明 ( 以功能逐渐强大为序 ):

1) Class EscapeUtils


Provides an API to allow data to be escape encoded and decoded. Also provide an API for converting a UNICODE data (16-bit descriptor) into UTF8 data (8-bit descriptor) and vice-verse.


Location: EscapeUtils.h

Link against: inetprotutil.lib

2) class CnvUtfConverter


Converts text between Unicode (UCS-2) and the two Unicode transformation formats UTF-7 and UTF-8. There are no functions to convert directly between UTF-7 and UTF-8.

Objects of this class do not need to be created because all the member functions are static. The four functions are passed text in the second argument and output the resulting text in the first argument. Sixteen-bit descriptors are used to hold text encoded in UCS-2 (i.e. normal 16 bit Unicode), and eight-bit descriptors are used to hold text encoded in either of the transformation formats.

The conversion functions return the number of characters which were not converted because the output descriptor was not long enough to hold all of the converted text. This allows users of this class to perform partial conversions on an input descriptor, handling the case when the input descriptor is truncated mid way through a multi-byte character. The caller does not have to guess how big to make the output descriptor for a given input descriptor- they can simply do the conversion in a loop using a small output descriptor. The ability to handle truncated descriptors is particularly useful if the caller is receiving information in chunks from an external source.

1 2  下一页

Tags:Symbian 一些 编码

编辑录入:coldstar [复制链接] [打 印]