ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How to show non-English characters?
Posted by Mike Dd on May-31-2016 10:55
Dear Sir/Madam,

In

layer->addDataSet(viewPortDataSeriesA, 0xff0000, _T("Non-English-Charset"));//"Alpha");


I would like to use some non-English characters. But it doesn't work. It shows a bunch of garbbish symbols...

Could you please help me?

Thanks a lot!

  Re: How to show non-English characters?
Posted by Peter Kwan on May-31-2016 22:59
Hi Mike,

ChartDirector assumes all text to be UTF8 encoded. In MFC, I think the _T string can be Unicode (2 bytes per character) or a kind of ANSI encoding, depending on how your MFC project is configured. (An ANSI encoding only works for one language. In contrast, UTF8 works for all languages at the same time.)

If you are using _T string, there is a TCHARtoUTF8 utility in ChartDirector that can convert _T string to UTF8 string:

layer->addDataSet(viewPortDataSeriesA, 0xff0000, TCHARtoUTF8(_T("Non-English-Charset")));//"Alpha");

Also, if you need to display the character (eg. as the text in the legend box), please use a font that can support your language. For example, for traditional chinese, I often use:

c->addLegend(x, y, true, "mingliu.ttc", 10);

or

c->setDefaultFonts("mingliu.ttc", "mingliu.ttc bold");

Hope this can help.

Regards
Peter Kwan

  Re: How to show non-English characters?
Posted by Mike Dd on Jun-01-2016 10:41
It worked like a charm. Thanks a lot!