How to show € symbol in LabelTTF

How to show € symbol in LabelTTF
0.0 0


I’m using cocos2d-x 2.2.2 under VS2012.
Im trying to show the € symbol using many approach, all unsuccessfull. As An example:

std::string temp_str = “130 €”;
CCLabelTTF* titleButton = CCLabelTTF::create(temp_str.c_str(), “Arial”, 40);

or using plist:

std::string _path = CCFileUtils::sharedFileUtils()->getWritablePath();
_path.append (t_name_file);
CCDictionary Dict = NULL;
if (CCFileUtils::sharedFileUtils()->isFileExist(_path)) Dict = CCDictionary::createWithContentsOfFile(_path.c_str());
else return false;
temp_str = ((CCString*)Dict->objectForKey(“Total”));
CCLabelTTF* titleButton = CCLabelTTF::create(temp_str->getCString(), “Arial”, 40);

No way. I always got ‘130’ and strange chars intead of ‘€’.

Could someone help me?


I don’t know if it’s because your symbol is too special or something else, but in our project, the CCLabelTTF works perfect for Chinese and Korean characters. Considering i18n, we stored our strings in different xml files. If we guarantee xml files encoded in utf-8, the CCLabelTTF show strings correctly.


I’m googling it but I can’t able to solve it. Strangely, I’m able to show many different symbols ($, £, à, ò, ù…) BUT the €. What a shame! My xml it UTF-8 encoded, but nothing changes.
Could you please check about it? I’m not sure if it’s a VS2012 bug or I should investigate elsewhere.


@Zappescu Sorry I’m not using vs2012, but Mac. I just wrote the following simple line in XCode, and it works fine.
CCLabelTTF::create("€", DEFAULT_FONT, 30);


It should be a PC/VS issue. I saved all my .h and .cpp files in UTF-8 but no way. The € symbol is shown as “€”, even if I use the encoding \u20AC for it.
I’ve seen I can use the LabelBMFont to show the € symbol but I’m trying now to merge a LabelTTF with a LabelBMFont. Still under contruction…