Home > Backend Development > PHP Tutorial > How to solve the problem of Chinese garbled characters in JpGraph

How to solve the problem of Chinese garbled characters in JpGraph

WBOY
Release: 2016-07-30 13:30:19
Original
1185 people have browsed it

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>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template