I tried to use iconv to transcode and output Chinese characters, but I still searched the internet for a long time without finding a solution. How can this be solved? I tried to use iconv to transcode and output Chinese characters, but it is still garbled.
$ S = "If your output is sunny"; $ ss = iconv ("gb2312", "utf8", $ s); $ im = ImageCreate (400,400 ); $ black = ImageColorAllocate ($ im, 0x5,200,200 x); ImageString ($ im, $ ss, $ black); Header ('content-Type: image/png '); ImagePNG ($ im );
I searched the internet for a long time and did not find a solution. How can this be solved?
Reply content:
I tried to use iconv to transcode and output Chinese characters, but it is still garbled.
$ S = "If your output is sunny"; $ ss = iconv ("gb2312", "utf8", $ s); $ im = ImageCreate (400,400 ); $ black = ImageColorAllocate ($ im, 0x5,200,200 x); ImageString ($ im, $ ss, $ black); Header ('content-Type: image/png '); ImagePNG ($ im );
I searched the internet for a long time and did not find a solution. How can this be solved?
Imagestring uses a dot matrix font. If you really want to use it, you need to construct a Chinese dot matrix font and then use imageloadfont to load it.
We recommend that you use the imagettftext function.
It is best to output Chinese Charactersimagettftext()
imagestring
Basically powerless