unicode char from ccstring

unicode char from ccstring
0.0 0


Going at this for hours.

I can read unicode strings from xml without problems:
CCDictionary* pDict = CCDictionary::createWithContentsOfFile(“my.xml”);
const char * onestr = ((cocos2d::CCString**)pDict~~>objectForKey)~~>getCString;
I can feed it to the BMFont:
CCLabelBMFont**rLetter = CCLabelBMFont::create(onestr, “abc.fnt”);

But I only need ONE SINGLE (random) char from that string (“onestr”), and feed it to BMFont.
Ascii chars are no problem. Unicode (CE) chars are a no-go. I know the problem with 2byte chars, I just don’t know how to solve it.

The question is: HOW to get a SINGLE UNICODE char from a CCString (or char* or whatever) so BMFont will recognize it.


Maybe this library helps you: http://utfcpp.sourceforge.net/
Compatible with cocos2d-x, at least in Android project.


Thanks, will check it out.
Compatible with IOS too?


No idea, test it youself :slight_smile:


Thank you Adamos .