Search code examples
excelcoldfusioncoldfusion-8

Apostrophes converting to ' in Coldfusion Excel Export


Some apostrophes/single quotes in my output are converting to '. I don't know why some do and some don't. Is there a way to universally make sure that this character, and other non-alphanumeric, don't convert to ASCII?

<cfsetting enablecfoutputonly="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<cfheader name="Content-Disposition" value="filename=#filename#.xls">
<cfcontent type="application/msexcel" />
<cfoutput>#TheReport.Data#</cfoutput>

Update: A sample of the output itself

<cfset delimiter = Chr(9) />
<cfset new_line = Chr(13) & Chr(10) />
<cfoutput query="report">
  <cfset output = output & "#id##delimiter##first_name##delimiter##last_name#">
  <cfset output = output & new_line />
</cfoutput>

Solution

  • If you remove the cfheader and cfcontent (and view source to see the actual content), does the problem go away?

    If not, then the encoded quotes are in the original TheReport.Data variable, and not related to outputting as an application/msexcel file.