Get Chinese pinyin for Symbian

Source: Internet
Author: User
 

// -------------------------------------------------------------- Obtain the 8-character Chinese Character pinyin ------------------------------------------------
Tbuf <128> ainfo1 (L "kerrnone ");
Tbuf <128> ainfo2 (L "kerrnotsupported ");
_ Lit8 (kstrtest, "Zhengzhou ");
Hbufc * Ptest = nhelper: convgbk2unil (kstrtest); // This function is defined in other files. The function is to convert the kstrtest short character to a GBK character.
Cptiengine * aengine = cptiengine: newl ();
Aengine-> activatelanguagel (elangprcchinese );
Const tuint16 * nuint = Ptest-> des (). PTR ();
Tbuf <128> aout;
Tint nret = aengine-> getspelling (* nuint, aout, eptipinyin );
If (nret = kerrnone)
{
Ceikonenv: static ()-> infowinl (ainfo1, aout );
}
Else if (nret = kerrnotsupported)
{
Ceikonenv: static ()-> infowinl (ainfo2, ainfo2 );
}
Else
{
Ceikonenv: static ()-> infowinl (aout, aout );
}
If (Ptest)
{
Delete Ptest;
Ptest = NULL;
}
Aengine-> closecuritydomainagel ();
If (aengine)
{
Delete aengine;
Aengine = NULL;
}

// -------------------------------------------------------- Obtain the first letter of the Chinese alphabet with a length of 16 characters ------------------------------------------------------

Cptiengine * aengine = cptiengine: newl ();
Aengine-> activatelanguagel (elangprcchinese );
// Total number of records
Tint ncount = iallrecord. Count ();
For (tint I = 0; I <ncount; I ++)
{
// How long is the name of each record?
Tint nnamelength = iallrecord [I]-> INAME. Length ();
For (tint J = 0; j <nnamelength; j ++)
{
Tuint16 iint16 = iallrecord [I]-> INAME [J];
Tbuf <3> bmid;
Bmid. append (iallrecord [I]-> INAME. mid (J, 1 ));
// If the character is a Chinese character
If (iint16> = 0x4e00) & (iint16 <= 0x9fa5 ))
{
Hbufc * Ptest = hbufc: newl (6 );
Ptest-> des (). append (bmid );
Const tuint16 * nuint = Ptest-> des (). PTR ();
Tbuf <128> aout;
Tint nret = aengine-> getspelling (* nuint, aout, eptipinyin );
If (nret = kerrnone)
{
// If you have obtained a full spell, only the first spell is captured.
If (0 <aout. Length ())
{
Iallrecord [I]-> ijianpin. append (aout. mid (0, 1 ));
}
}
Mem_free (Ptest );
}
// If it is not a Chinese character, append the letter to the shortlist.
Else
{
Iallrecord [I]-> ijianpin. append (bmid );
}
}
}
Aengine-> closecuritydomainagel ();
Mem_free (aengine );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.