Home >Backend Development >PHP Problem >How to convert php Chinese to gbk
How to convert Chinese to gbk from php: 1. Find and open the corresponding PHP file; 2. Convert it through "$fileName=iconv("UTF-8", "gbk", $fileName);" It can be the Chinese encoding format of gbk.
#The operating environment of this article: Windows 7 system, PHP8, Dell G3 computer.
Usually when uploading files in PHP, if the file name contains Chinese characters, the uploaded name cannot be written locally, because the uploaded encoding format is generally UTF-8 format, which cannot be Name the file and save it to the operating system disk. It needs to be converted to gbk Chinese encoding format before writing:
$fileName=iconv("UTF-8", "gbk", $fileName);
Similarly, the file name obtained by reading the file from the system disk is in gbk encoding format. This format PHP cannot be passed to other pages. , then you need to encode it into UTF-8 format:
$fileName=iconv("gbk", "UTF-8", $fileName);
Extended information
Many people find that there are not enough characters during use. , because everyone mainly uses the GB coded font library. This coding standard only contains 6763 commonly used Chinese characters. A large number of Chinese characters outside the GB font library can only be filled in through the Founder Nuwa character filling software or other character creation programs. Although the supplemented Chinese characters meet the needs in terms of glyphs.
However, it is difficult to coordinate the font style, size, and structure, and it is even more unsightly to use manual mapping to fill in the characters. Furthermore, if users build an information system or need to query news or published content, it is impossible to rely on word filling. The GBK font library developed by Founder will greatly alleviate the problem of missing characters.
The GB font library was expanded to the GBK font library, adding more than 14,000 characters. Peking University Founder invested a lot of manpower in 1996 and began to produce GBK fonts in Hei, Song, imitation and regular script. In April 1998, it became the first professional manufacturer to pass the GBK font appraisal organized by the national authoritative department.
Peking University Founder has converted all fonts into GBK fonts, a total of 46 types, 18 of which have 21,003 characters, making it the manufacturer with the largest number of GBK fonts.
Recommended: "PHP Video Tutorial"
The above is the detailed content of How to convert php Chinese to gbk. For more information, please follow other related articles on the PHP Chinese website!