PhpphpExcel export, Chinese garbled characters, who can help explain it?

Source: Internet
Author: User
1 & amp; gt; array (size12) 1 & amp; gt; string & #039 ;?? & #039; (leng22.) 2 & amp; gt; string & #039 ;?? Id & #039; (length4) 3 & amp; gt; string & #039 ;?????? & #039; (length7) 4 & amp; gt; string & #039 ;??????? & #039; (length8) 5 & amp; gt; string & #039 ;????? & Amp; 1 = & gt;
Array (size = 12)
1 => string '?? '(Length = 2)
2 => string '?? Id' (length = 4)
3 => string '??? ??? '(Length = 7)
4 => string '????
??? '(Length = 8)
5 => string '?? ??? '(Length = 6)
6 => string '??
??? '(Length = 6)
7 => string '???? ??? '(Length = 8)
8 => string '????
??? '(Length = 8)
9 => string '??? ?? '(Length = 6)
10 => string '???? '(Length = 4)
11 => string '??
?? '(Length = 5)
12 => string '???? _?? '(Length = 7)
2 =>
Array (size = 9)
1 => string '4' (length = 1)
2 => string '11' (length = 2)
3 => string '????? '(Length = 5)
5 => string '?? '(Length = 2)
6 => string '?? '(Length = 2)
8 => string 'HTTP: // shanghai.anjuke.com/community/view/4' (length = 43)
9 => string '????? '(Length = 5)
10 => string 'HTTP: // mingmenbinjiangyuan.soufun.com/'(length = 38)
11 => string '?? '(Length = 2)

Reply content:

1 =>
Array (size = 12)
1 => string '?? '(Length = 2)
2 => string '?? Id' (length = 4)
3 => string '?????? '(Length = 7)
4 => string '????
??? '(Length = 8)
5 => string '????? '(Length = 6)
6 => string '??
??? '(Length = 6)
7 => string '??????? '(Length = 8)
8 => string '????
??? '(Length = 8)
9 => string '????? '(Length = 6)
10 => string '???? '(Length = 4)
11 => string '??
?? '(Length = 5)
12 => string '???? _?? '(Length = 7)
2 =>
Array (size = 9)
1 => string '4' (length = 1)
2 => string '11' (length = 2)
3 => string '????? '(Length = 5)
5 => string '?? '(Length = 2)
6 => string '?? '(Length = 2)
8 => string 'HTTP: // shanghai.anjuke.com/community/view/4' (length = 43)
9 => string '????? '(Length = 5)
10 => string 'HTTP: // mingmenbinjiangyuan.soufun.com/'(length = 38)
11 => string '?? '(Length = 2)

If the php code is UTF-8, the exported code is UTF-8. As long as the php header file is correctly set, there will be no problems. The 2003, 2010, and 2013 offices can be opened normally, however, 2007 may cause garbled characters. The reason may be that 2007 does not support Unicode well. You can set 2007 on the Internet, but this is obviously not a good solution, the following statements can be used to convert strings during output.

iconv("UTF-8","GBK",$str)

In this way, there will be no garbled characters in any excel file.

First convert data into UTF-8 can use iconv Function

You need to forcibly convert php encoding to UTF-8, that isheader("Content-type: text/html; charset=utf-8")This is php implementation ......

Just look at the above content, we can see that the situation may occur when you take out the time from the database, there may be garbled characters, or, as said, php output does not set the character encoding, garbled characters are displayed on the page. However, the title of your question says phpExcel export garbled characters. In this case, I still feel very likely that your database will be garbled.

I suggest you look here: http://www.iteye.com/topic/461900

TIPS:This is not a "smart question". I have provided too little information and don't know what the problem is. I hope the questioner can clarify your questions in the future.

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.