Jpgraph is a powerful drawing component that can draw any graphics according to the user's needs. You only need to provide data, you can automatically call the drawing function process, and input the processed data to automatically draw. However, the support for Chinese is not very good, and there will be Chinese garbled problems.
Solution
For example, The given title is in Chinese and can be in the following format:
<code><span>//setup title </span><span>$title</span>=<span>"我的个人网址是:www.54yongf.com"</span>; <span>$title</span>=iconv(<span>"UTF-8"</span>,<span>"GB2312//IGNORE"</span>,<span>$title</span>); <span>$graph</span>->title->Set(<span>$title</span>); <span>$graph</span>->title->setFont(FF_SIMSUN,FS_BOLD,<span>14</span>);</code>
In the above case, $title
contains Chinese, so you must first use the iconv
function to convert the encoding to gb2312 code, and add it after The sentence on the fifth line, in this way, can display Chinese.
Copyright statement: Reprinting and spreading are welcome, but when reprinting, please indicate the author and the source of the original text in a prominent position. Thank you for your cooperation!
The above introduces how to solve the problem of Chinese garbled characters in JpGraph, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.