In the cocos2d-x with Airplay, i want to use multi-language, but when we set a unicode string in CCLabelBMFont it convert in ascii. when i debug it, i found that it’s a double byte char problem. if some one have any solution than please help me. for it, am create a function but it can’t work.
std::string utf8_encode(const std::string wstr)
{
const int maxCaptionLength = strlen(wstr.c_str());
ucs2char inBuffer[maxCaptionLength + 1];
int inChars = IwUTF8ToWideChar(wstr.c_str(), -1, inBuffer, sizeof(inBuffer)/sizeof(inBuffer[0]));
std::string strTo( inChars, 0 );
if (0 <= inChars && inChars <= maxCaptionLength)
{
char outBuffer[4 * maxCaptionLength + 1];
int outBytes = IwWideCharToUTF8(inBuffer, -1, outBuffer, sizeof(outBuffer)/sizeof(outBuffer[0]));
strTo = outBuffer;
}
return strTo;
}