How do I stop the character set in the HTTP headers of a Railo app?
I am using Railo 3.0 for a web application (setup is exactly the same as this excellent tutorial). I have a CFM page that serves some old HTML files using the cfcontent tag. This content is in different character sets (they are all defined as meta tags in HTML). The problem is that all of my CFM pages are being sent with UTF-8 set in the HTTP response headers and this overrides anything defined in the HTML. Therefore, the pages are not displayed correctly in the browser.
How can I stop encoding being sent in HTTP headers for CFM pages?
Notes: I removed the AddDefaultCharset entry from the default Apache config and that means static HTML pages are now served without any header encoding, however that didn't help for CFM pages - AddDefaultCharset is bad, bad, bad
a source to share
I know this is an old thread, but I recently had a similar problem and overcame it using a basic java servlet context. If you get ServletResponse you can call .reset () which, according to the Java docs, says:
Removes any data that exists in the buffer, as well as status code and headers .
You need to rewrite ALL headers from scratch, but it will clear the rogue heading header.
<cfset objResponse = GetPageContext().getResponse()>
<cfset objResponse.reset()>
This works in Railo. In CF (Adobe) I think you need to call getResponse () twice to get the corresponding response object.
Hope this helps someone.
a source to share
what encoding are you trying to send the pages to? you can force the encoding of the page in several ways:
<cfprocessingdirective pageEncoding="windows-1252">
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_p-q_13.html#2962107
<cfheader name="charset" value="windows-1252">
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_07.html#3989067
a source to share