Php cannot read Chinese image files, encoding problems-php Tutorial

Source: Internet
Author: User
Php cannot read Chinese image files. encoding error: PHPcode & lt ;? Php?imagethumbnail .jpg; $ percent0.05; $ imgetimagesize ($ image); $ width $ im [0]; $ hight $ im [1]; switch ($ im [2]) {case1: [email & #160; protected] ($ php cannot read Chinese image files, encoding problems
PHP code
  
  


The result of creating a Chinese name is garbled .. Php is UTF-8,

------ Solution --------------------
We recommend that you do not use Chinese names.
------ Solution --------------------
We recommend that you use the iconv function to convert the file name to gbk.
------ Solution --------------------
Php itself does not support Chinese characters.
The procedure is as follows:
$ Image = iconv ("UTF-8", "gb2312", $ image );
The first parameter is the input character encoding, the second is the character encoding you want to convert, and the third is the converted string.
------ Solution --------------------
Save the php file. Note the saved encoding
------ Solution --------------------
The best way is to stop using Chinese.
------ Solution --------------------
It is best to use UTF-8 in windows and explicitly declare that no matter whether it is a static page or not, do not use a Chinese name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.