1
2
3
4
|
XYChart
*c = new XYChart(640,
350); char buffer1[256]
= "" ; UnicodeToUtf8(L "Realtime
Chart with Zoom/Scroll and Track Line测试" ,
buffer1); c->addTitle(buffer1, "simsun.ttc" ,
18); |
UnicodeToUtf8()函数实现如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
void UnicodeToUtf8( const TCHAR *unicode, char *utf8) { int len
= WideCharToMultiByte(CP_UTF8, 0, ( const TCHAR *)unicode,
-1, NULL, 0, NULL, NULL); memset (utf8,
0, len * 2 + 2); WideCharToMultiByte(CP_UTF8,
0, ( const TCHAR *)unicode,
-1, utf8, len, NULL, NULL); } void Utf8ToUnicode( const char *utf8, TCHAR *unicode) { int len
= MultiByteToWideChar(CP_UTF8, 0, ( const char *)utf8,
-1, NULL, 0); MultiByteToWideChar(CP_UTF8,
NULL, utf8, -1, unicode, len); } |