Xiaomei, may I ask phpExcelReader about an error in reading the Chinese excel file?

Source: Internet
Author: User
Xiaomei asked phpExcelReader to read the Chinese Excel file. I have a php file and the user chooses the xls file. ReadExcel. phpPHPcode & lt ;? Phprequire_onceExcelreader.php; $ file_name $ _ REQUEST [file1]; if ($ file_name! & Quot;) {Xiaomei asked phpExcelReader about an error occurred while reading the Chinese Excel file.
I have a php file and select the xls file.

ReadExcel. php
PHP code
  
  SetOutputEncoding ('utf-8'); $ data-> read (iconv ("UTF-8", "GB2312", $ file_name); error_reporting (E_ALL ^ E_NOTICE ); for ($ I = 1; $ I <= $ data-> sheets [0] ['numrows ']; $ I ++) {for ($ j = 1; $ j <= $ data-> sheets [0] ['numcols']; $ j ++) {echo "\"". $ data-> sheets [0] ['cells '] [$ I] [$ j]. "\", ";}echo" \ n ";}}?>
  Read Excel

My phpExcelReader is from
Http://cdnetworks-kr-2.dl.sourceforge.net/project/phpexcelreader/Spreadsheet_Excel_Reader/Interim%20update/phpExcelReader.zip

Download.
Changed require_once 'oleread. Inc' in reader. php ';
This place.

I wrote this php page to read non-Chinese Excel files. no error is reported and can be read.

If an Excel file with a Chinese name is read, an error is returned.
The filename XXX.xls is not readable

For example, I have two Excel files in the ddisk root directory, one is abc.xls and the other is test.xls.

The content in the two xls is completely consistent.

Reading abc.xls is normal.

Read test. XLS is reported.
The filename test .xls is not readable

I have used phpExcelReader to explain how to modify it.

------ Solution --------------------
Iconv ("UTF-8", "gb2312", $ file_name)

Try this conversion

------ Solution --------------------
Echo iconv ("UTF-8", "gb2312", $ file_name );
What do you get?

------ Solution --------------------
Discussion

The result is as follows:
Test. xls
The filename test .xls is not readable

------ Solution --------------------
Generally, Chinese paths are not supported.
------ Solution --------------------
Reference: http://witmax.cn/php-read-excel.html

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.