Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

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

From Wiki
Jump to: navigation, search
Article Metadata

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

文章
翻译:
hoolee
最后由 hamishwillee 在 30 May 2013 编辑
  • 详细描述

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 );
This page was last modified on 30 May 2013, at 04:36.
317 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.

×