ph-peer Posted June 8, 2009 Share Posted June 8, 2009 hi guys... weeee!!!!....this is my first post here and i hope you'll be answering me ...heheh ======================================================= PROBLEM: Displaying characters such as "...ñÑ" characters with my php generated excel downloadable file... TRIED... Solution 1: adding "charset:utf-8" in the header Result 1: no effect Solution 2: used htmlentities/html_entity_decode Result 2: does not have any effect too any idea guys...thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/161342-utf-8-charset-for-headercontent-type-applicationx-msexcel-not-working/ Share on other sites More sharing options...
Mark Baker Posted June 8, 2009 Share Posted June 8, 2009 How are you generating the Excel file? Headers for an Excel download should be: header ('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header ('Content-Disposition: attachment; filename="filename.xlsx"'); header ('Content-Transfer-Encoding: binary'); header ('Content-Length: '.$fileSize); for Excel 2007 header ('Content-Type: application/vnd.ms-excel'); header ('Content-Disposition: attachment; filename="filename.xls"'); header ('Content-Transfer-Encoding: binary'); header ('Content-Length: '.$fileSize); for Excel 5/2003 formats The content that you're downloading should already be UTF-8 content Quote Link to comment https://forums.phpfreaks.com/topic/161342-utf-8-charset-for-headercontent-type-applicationx-msexcel-not-working/#findComment-851490 Share on other sites More sharing options...
ph-peer Posted June 9, 2009 Author Share Posted June 9, 2009 hi mark! thanks for the reply!... however i think i have to make my excel file more flexible to all versions... for now what i did is to add utf8_decode function for my fields which is affected by my problem...and now they are being displayed properly... thanks for the info, it will be very useful for my future revisions and new projects! thanks dude! Quote Link to comment https://forums.phpfreaks.com/topic/161342-utf-8-charset-for-headercontent-type-applicationx-msexcel-not-working/#findComment-852075 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.