Whatever message this page gives is out now! Go check it out!

WriteOutput

Last update:
May 18, 2026

Description

Appends text to the page-output stream. This function writes to the page-output stream regardless of conditions established by the cfsetting tag.

Category

Function syntax

WriteOutput(string [,encodefor])

History

Introduced in ColdFusion 4.5
Parameters
Parameter
Description
string
A string or a variable that contains one.
encodefor
This parameter's functionality is similar to the ' encodeFor ' functions.
The valid values are html , htmlattribute , url , javascript, css , xml , xmlattribute , xpath , ldap , and dn . Based on the respective value, the encoding will be applied on the input string. This parameter is optional.

 

Returns

A Boolean.

See also

Usage

Within the cfquery and cfmail tags, this function does not output to the current page; it writes to the current SQL statement or mail text. Do not use WriteOutput within cfquery and cfmail. Although you can call this function anywhere within a page, it is most useful inside a cfscript block.

Example 1

<cfscript>
    // encodeFor=url
    writeoutput("encoding for url: ");
    writeoutput("lorem ipsum _*&%^$%&@","url");
</cfscript>
Output
encoding for url: lorem+ipsum+_*%26%25%5E%24%25%26%40
Example 2
 
<cfscript>
    // encodeFor=html
    writeoutput("encoding for html: ");
    writeoutput("lorem ipsum _*&%^$%&@","html");
</cfscript>
Output
encoding for html: lorem ipsum _*&%^$%&@
Example 3
 
<cfscript>
    // encodeFor=css
    writeoutput("encoding for css: ");
    writeoutput("lorem ipsum _*&%^$%&@","css");
</cfscript>
Output
encoding for css: lorem\20 ipsum\20 \5f \2a \26 \25 \5e \24 \25 \26 \40

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page