Determining the character encoding of a ColdFusion page

When a request for a ColdFusion page occurs, ColdFusion opens the page, processes the content, and returns the results back to the browser of the requestor. To process the ColdFusion page, though, ColdFusion has to interpret the page content.

One piece of information used by ColdFusion is the Byte Order Mark (BOM) in a ColdFusion page. The BOM is a special character at the beginning of a text stream that specifies the order of bytes in multibyte characters used by the page. The following table lists the common BOM values:

Encoding

BOM signature

UTF-8

EF BB BF

UTF-16 Big Endian

FE FF

UTF-16 Little Endian

FF FE

To insert a BOM character in a CFML page easily, your editor must support BOM characters. Many web page development tools support insertion of these characters, including Dreamweaver, which automatically sets the BOM based on the Page Properties Document Encoding selection.

If your page does not contain a BOM, you can use the cfprocessingdirective tag to set the character encoding of the page. If you insert the cfprocessingdirective tag on a page that has a BOM, the information specified by the cfprocessingdirective tag must be the same as for the BOM; otherwise, ColdFusion issues an error.

The following procedure describes how ColdFusion recognizes the encoding format of a ColdFusion page.