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

Message ListMessage List     Post MessagePost Message

  Using symbols in text strings
Posted by Chuck Willette on Feb-08-2012 23:04
I need to use the symbol for micro and the symbol for copyright is labels and text boxes.
How do I embed them or any other special ASCII code?

Regards,
Chuck

  Re: Using symbols in text strings
Posted by Peter Kwan on Feb-09-2012 01:05
Hi Chuck,

ChartDirector assumes UTF8 encoding for text strings. To enter any character, you may simply enter them in UTF8. There are several methods, depending on where does your text come from, and how your compiler supports UTF8.

For example, if your text comes the source code (that is, hard coded as string literals in the source code, rather than reading from a database), some compilers allow you to enter and compile the source code in UTF8.

Another method is to simply enter the text in C escape sequence. First, you need to find out what is the UTF8 bytes for your character. For example according to the online conversion tool:

http://people.w3.org/rishida/scripts/uniview/conversion.php

The copyright character, which is at the unicode code point U+00A9 (you can look for it in the Windows character map), will be C2 A9 in UTF8. So in C++ syntax, the text string is "\\xC2\\xA9".

If your text does not come from the source code, but from some external source (eg. a database), you would need to convert from whatever encoding your database is using to UTF8. Some functions that may help you are the Win32 function WideCharToMultiByte and the ChartDirector function TCHARtoUTF8.

Note that you must use a font that does have the copyright character and other characters you would like to use. This should not be an issue on Windows or Mac OS X, but special considerations may be required on Linux, FreeBSD or Solaris.

Regards
Peter Kwan