Here to tell you the principle of GD in the display of Chinese. I believe you can easily write one out after you have finished reading it.
The GD Library in PHP is in fact supported in Chinese, but must be passed in UTF-8 format parameters, you can experiment with the following small program.
You will be able to see the graphical display of the words "Chinese OK". (
Utf-8:unicode Transfer Format 8 is a compatible representation of Unicode
Header ("Content-type:image/gif");
$im = Imagecreate (400,300);
$bkg = Imagecolorallocate ($im, 0,0,0);
$CLR = Imagecolorallocate ($im, 255,255,255);
$FNT = "C:/winnt/fonts/simhei.ttf";
If 98/95 "C:/windows/fonts/simhei.ttf";
$STR = Chr (0xE4). chr (0XB8). chr (0xAD). chr (0xe6). chr (0x96). chr (0x87). " OK ";
"Chinese OK" in Utf-8imagettftext ($im, 0, Ten, A, $CLR, $fnt, $STR);
Imagegif ($im);
Imagedestroy ($im);? >
If you just want to display a fixed Chinese string then you can convert the displayed characters to UTF-8 format in Word, four-pass cubic, etc., and then paste them into the program. If you want to dynamically display the corresponding Chinese characters according to the user's input, then it is necessary to solve the problem of converting the inner code of Chinese characters into UTF-8 format.
I am not very clear about the Chinese processing under the unix/linux, have no say, if it is in Unicode, then the Unicode should be converted to UTF-8 format.
If the GBK code is used like WIN95/98, then it should be converted to Unicode before conversion to UTF-8 format.
With regard to the conversion of gbk-unicode, I have used a very foolish solution, which I propose here for your discussion. We hope that we can propose a more simple and efficient solution.
I'm going to use this little program to show all the GBK characters and then convert it to Unicode in Word. Each character is transferred to the corresponding Unicode value based on the string. The process of Unicode representation as UTF-8 refers to the translator CVTUTF.C on Unicode, cvtutf.h.
$i <= 0xFE; $i + +) {
0x81-0xfe
for ($j = 0x40; $j <= 0xFE; $j + +) {
0x40-0x7e 0x80-0xfe
if ($j! = 0x7F) {
echo chr ($i). chr ($J);
}}}?>
http://www.bkjia.com/PHPjc/532075.html www.bkjia.com true http://www.bkjia.com/PHPjc/532075.html techarticle here to tell you the principle of GD in the display of Chinese. I believe you can easily write one out after you have finished reading it. The GD library in PHP actually supports Chinese, but it must be in UTF-8 format ...