- Header ("Content-type: application/vnd. ms-excel ");
- Header ("Content-Disposition: attachment?filename=export_data.xls ");
- Echo "name". "\ t ";
- Echo "traditional". "\ t ";
- Echo "blog". "\ t ";
- Echo "\ n ";
- Echo "jason". "\ t ";
- Echo "@". "\ t ";
- Echo "javaeye". "\ t ";
- ?>
Consider adding the character set header ("Content-type: application/vnd. ms-excel; charset = UTF-8") to the header "); Question: I only want to tell the browser which character set to choose to view. In the end, I still need to generate xls files. some friends suggest iconv transcoding.
- Echo iconv ("current code", "GB18030", "This blog is from javaeye, by jason ");
Q: In this case, the Chinese character encoding in the file is GB18030. but what encoding does Excel know to use to open the file? You can only rely entirely on the default OS. However, if you encounter BIG5 in traditional Chinese style, garbled characters will still occur. Finally, use phpMyAdmin and HTMLExcel.
- Xmlns: x = "urn: schemas-microsoft-com: office: excel"
- Xmlns = "http://www.w3.org/TR/REC-html40">
-
1234 |
Robbin will spit |
5678 |
Javaeye website |
-
In this way, you can directly echo, and do not need iconv transcoding, as long as you set the Content-type in HTML (here using the UTF-8), of course, the header still needs to add:
- Header ("Content-type: application/vnd. ms-excel ");
- Header ("Content-Disposition: attachment?filename=export_data.xls ");
This is the case. if you are interested, take a quick test and check whether there are no garbled characters in the exported Chinese content excel ?! |