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

Message ListMessage List     Post MessagePost Message

  Different character codes in legend and tooltip ?
Posted by Raimund on Jul-21-2023 00:25
Attachments:
The dataset name in one of my line chart is "L:Test: Stromwinkel in °el"

As you can see in the appendix, the dataset name is displayed correctly in the legend, in the tool tip the character "°" is displayed incorrectly.

Is there a simple way to work around this problem, e.g. by recoding the character?
Screenshot 2023-07-20 155651.png

  Re: Different character codes in legend and tooltip ?
Posted by Peter Kwan on Jul-21-2023 15:05
Attachments:
Hi Raimund,

I suspect it is something related to the character encoding used.

ChartDirector always assumes all text strings to be in UTF8 encoding. The UTF8 encoding supports all unicode characters, and it is also compatible with C text strings (char*).

To ensure the encoding is correct is as follows:

(1) If your text string is a string literal in the source code, we suggest you use unicode text strings (L"xxx" strings), and use ChartDirector WCHARtoUTF8 to convert it to UTF8.

layer->addDataSet(myData, myColor, WCHARtoUTF8(L"L:Test: Stromwinkel in °el"));

If your text string is not in your source code (eg. it is read from a database or use input), please at least make sure it is a valid MFC _T string or CString, then use TCHARtoUTF8 to convert it to UTF8.

(2) In your project, we suggest to set "Project/Properties/Advanced/Character Set" to "Unicode Character Set".

(3) When you save your source code, you can save it in UTF8 format. (When you choose "File/Save As", Visual Studio allows you to choose "Save with Encoding". If you do not save with encoding, next time Visual Studio or the compiler opens the file, it may forget which encoding is being used.)

Best Regards
Peter Kwan
mfcdemo_20230721142141.png

  Re: Different character codes in legend and tooltip ?
Posted by Raimund on Jul-21-2023 15:20
Hi Peter,

thanks so lot for your kind help!

Raimund