Lex Nguyen
Lex Nguyen

Reputation: 401

Cocos2d-x: Display japanese characters issue

I'm developing a mini game which display a list of japanese strings using CCLabelTTF.
But it just display like "???".
I have already searched on goolge but still do not know why. I'm using Visual Studio 2013, Cocos2d-x 2.2.4. Can anyone give me a solution ?

char* text = "仕事";

 pLabelTTF = CCLabelTTF::create(text, "Arial", 10.0f);

Thank you for your help.

Upvotes: 0

Views: 279

Answers (2)

Lex Nguyen
Lex Nguyen

Reputation: 401

The solution is save your source code file as UTF-8 without BOM

Upvotes: 0

Blisskarthik
Blisskarthik

Reputation: 1242

Hi I tried the same with the below pasted code. It works fine for me

CCString* keyString = CCString::createWithFormat("仕事");
CCLabelTTF * pLabelTTF = CCLabelTTF::create(keyString->getCString(), "Arial", 40.0f);
pLabelTTF->setColor(ccc3(100, 100, 100));
pLabelTTF->setPosition(ccp(origin.x+visibleSize.width/2, origin.y+visibleSize.height/2));
pLabelTTF->setZOrder(15);
this->addChild(pLabelTTF);

Output : http://screencast.com/t/hJuRua75JwB

Upvotes: 1

Related Questions