开发学院手机开发Symbian 开发 Symbian 中文字符串显示问题的解决 阅读

Symbian 中文字符串显示问题的解决

 2010-03-12 04:34:00 来源:WEB开发网   
核心提示:if(converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierGbk,aFileServerSession)!=CCnvCharacterSetConverter::EAvailable)User::Leave(KErrNotSupported);T

if(converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierGbk,aFileServerSession)!=CCnvCharacterSetConverter::EAvailable)

User::Leave(KErrNotSupported);

TInt state=CCnvCharacterSetConverter::KStateDefault;

TPtrC8 str( original );

HBufC* iInfoText = HBufC::NewL( str.Length() );

TPtr16 ptr = iInfoText->Des();

if(CCnvCharacterSetConverter::EErrorIllFormedInput == converter->ConvertToUnicode(ptr, str, state))

User::Leave(KErrArgument);

res.Zero() ;

res.Copy(ptr) ;

aFileServerSession.Close();

CleanupStack::PopAndDestroy();

delete iInfoText;

#else

res.Format(_L(”wayne len %d”), original.Length()) ;

#endif

}

void CMcAppUi::ConvUni2Gbk(TDesC& original, TDes8& res) {

#ifndef __WINS__

TInt state=CCnvCharacterSetConverter::KStateDefault ;

CCnvCharacterSetConverter* iConv ;

iConv = CCnvCharacterSetConverter::NewLC();

if(iConv->PrepareToConvertToOrFromL(KCharacterSetIdentifierGbk,

iEikonEnv->FsSession())!=CCnvCharacterSetConverter::EAvailable)

User::Leave(KErrNotSupported);

iConv->ConvertFromUnicode(res, original, state) ;

CleanupStack::PopAndDestroy() ;

Tags:Symbian 字符串

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接