×
Namespaces

Variants
Actions
Revision as of 09:49, 9 August 2012 by hamishwillee (Talk | contribs)

16位Unicode和UTF-8之间文本的转换

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台: S60 (All Editions), Series 80

文章
翻译:
hoolee
最后由 hamishwillee 在 09 Aug 2012 编辑
  • 详细描述

CnvUtfConverter类提供了静态函数用来转换16位的Unicode(UCS-2)描述符到8位(UTF-8)格式,反之也可以。


  • 解决方案
 #include <utf.h>    // link against charconv.lib
 
// Copy data from srcBuf16 to destBuf8
CnvUtfConverter::ConvertFromUnicodeToUtf8( destBuf8, srcBuf16 );
 
// 当无法预测转化后的UTF-8的长度时,可以使用下面这个函数
destHBuf8* ConvertFromUnicodeToUtf8L(srcBuf16);
 
 
// Copy data from srcBuf8 to destBuf16
CnvUtfConverter::ConvertToUnicodeFromUtf8( destBuf16, srcBuf8 );
 
// 当无法预测转化后的UNICODE的长度时,可以使用下面这个函数
destHBuf16* ConvertToUnicodeFromUtf8L( srcBuf8 );
186 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×