Thanks sadly to write a function of outputting Chinese characters in GD,
I found that the string of this version of this version must be pure Chinese and cannot be mixed.
This bug has been modified, share it with you. . .
// Program Writen by Sadly www.phpx.com
// modified by Agun 2000/6/20
FUNCTION GB2UTF8 ($ GB)
{
IF (! TRIM ($ GB))
Return $ GB;
$ filename = "gb2312.txt";
$ TMP = File ($ filename);
$ CODETABLE = array ();
While (list ($ key, $ value) = Each ($ TMP))
$ CODETABLE [HEXDEC (Substr ($ Value, 0, 6))] = Substr ($ Value, 7, 6);
$ RET = "";
$ UTF8 = ""
While ($ GB)
{
IF (ORD (Substr ($ GB, 0, 1)> 127)
Else
}
Return $ RET;
}
Function U2UTF8 ($ C)
{
For ($ I = 0; $ i $ Str = ""; IF ($ c <0x80) ELSE IF ($ C <0x800) { $ Str. = (0xc0 | $ C >> 6); $ Str. = (0x80 | $ C & 0x3f); } ELSE IF ($ C <0x10000) { $ Str. = (0xE0 | $ C >> 12); $ Str. = (0x80 | $ C >> 6 & 0x3f); $ Str. = (0x80 | $ C & 0x3f); } ELSE IF ($ C <0x200000) { $ Str. = (0xF0 | $ C >> 18); $ Str. = (0x80 | $ C >> 12 & 0x3f); $ Str. = (0x80 | $ C >> 6 & 0x3f); $ Str. = (0x80 | $ C & 0x3f); } Return $ STR; } Header ("Content-Type: Image / GIF"); $ IM = ImageCreate (300, 150); $ bkg = imagecoloralloccate ($ IM, 0, 0, 0); $ CLR = ImageColoralLocate ($ IM, 255, 255, 255); $ fnt = "c: windowsfontssiMsun.ttf"; //include ("Gb2utf8.php "); $ Str = GB2UTF8 ("China Agun Across"; ImageTfText ($ IM, 30, 0, 50, 50, $ CLR, $ FNT, $ STR); ImageGIF ($ IM); ImageDestroy ($ IM); ?>