Skip navigation
Currently Being Moderated

cfprocessingdirective pageencoding also not working

May 24, 2013 8:26 PM

Tags: #charset



I use the below code to export the data from ldap query to excel


<cfheader name="Content-Disposition" value="attachment; filename=Report.xls">

<cfcontent type="application/">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


But special characters appears as (?) symbol is excel sheet even though it displays correctly in browser


In Browser:



In Excel:


I even tried using <cfprocessingdirective pageencoding="utf-8" />


But still it appears same..


Pls advice

  • Currently Being Moderated
    May 24, 2013 11:14 PM   in reply to gokul1242

    <cfprocessingdirective> is irrelevant here, as it only relates to the source code of the file being compiled, not any data being processed.


    <meta> tags are browser instructions, and as you're specifically telling the browser not to deal with this response, that's not going to help either. Try setting the encoding as an HTTP header (so with <cfheader> rather than with a meta tag.


    That said, if you want an XLS file, simply sending text and saying "it's XLS" is not a good approach. Use CF's XLS-creation functions or POI to crate an actual XLS file.




    Mark as:
  • Currently Being Moderated
    May 26, 2013 2:23 AM   in reply to gokul1242

    There are plenty of docs out there on how to use <cfheader> and CF's spreadsheet functions. I'm not gonna write your code for you. However if you write some code and have issues, and post back with a question, I'll keep an eye out for you.


    CFHEADER: 1172e0811cbec22c24-7aea.html


    Spreadsheet functions 1172e0811cbec1a60c-7ffc.html#WSaad0660b0585370c-3b13488c12d7e9aabe0-80 00


    <cfspreadsheet> 1172e0811cbec17cba-7f87.html






    Mark as:
  • Currently Being Moderated
    May 26, 2013 4:04 AM   in reply to gokul1242

    Come on, help yourself a bit here. Just because you've asked for help on a forum doesn't mean you can then switch-off your brain and do no troubleshooting at all yourself.


    Did you read the docs for <cfspreadsheet>? What version of CF was it added in? What version of CF are you running? Even the error message gives a very strong clue as to what the story is here:


    This tag is not supported by this version of ColdFusion


    So you're using CF8 or lower (if you're using an obsolete version of CF, you really ought to mention this in your initial post), so <cfspreadsheet> is not available to you.


    So you'll need to use POI. Google it. Hint: Ben Nadel has written a CF wrapper for it.




    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points