Hi,
just as a round-up of this thread, here is a documentation of how to do this under Linux, in my case OpenSuSE 11.4:
1) Install a Chinese font; OpenSuSE offered "wqy-bitmapfont". Follow the installation instruction for this package to create the "fonts.dir" file and to tell X11 where to find the font files.
2) Then compile the following code. My compile command is simple:
gcc -o test_chinese test_chinese.c -ldislin
Using the source code file "test_chinese.c":
#include <stdio.h>
#include <string.h>
#include <dislin.h>
int main() {
char cstr[80];
int iray[100];
int ni;
int i;
strcpy(cstr, "中文");
printf("\n%s\n\n", cstr);
printf("strlen = %d\n\n", strlen(cstr));
for(i=0;i<strlen(cstr);i++)
printf(" %x\n", (unsigned char)cstr[i]);
printf("\n");
ni = utfint(cstr, &iray[0], 100);
printf("ni = %d\n", ni);
for(i=0;i<ni;i++)
printf(" %u %x\n", iray[i], iray[i]);
printf("\n");
metafl("CONS");
scrmod("REVERS");
window(100, 200, 500, 300);
disini();
x11fnt("-wenquanyi-wenquanyi bitmap song-medium-*-normal-", "-*-*-*-*-iso10646-1");
chacod("utf8");
hname(60);
height(60);
name(cstr, "X");
name("Y-axis", "Y");
titlin(cstr, 3);
labdig(-1, "XY");
graf(0.0, 10.0, 0.0, 2.0, 100.0, 200.0, 100.0, 20.0);
title();
endgrf();
disfin();
return(0);
}
The code shows you the byte-wise content of the UTF8 string with the chinese characters in hexadecimal and then uses "utfint" to calculate and display the UTF8 character number.
You can use the hexadecimal notation to look up the characters at:
http://www.utf8-chartable.de/unicode-utf8-table.pl
They are in the block "U+4E00 ... U+9FFF: CJK Unified Ideographs"
Since my "xterm" terminal and my "joe" editor support the chinese characters, I could directly copy&paste them into a normal C string without the need for the UTF8 character numbers. They are just displayed for completeness in the above code.
Cheers,
Armin