User Guide
674 Chapter 3: ColdFusion Functions
SetEncoding
Description
Sets the character encoding (character set) of Form and URL scope variable values; used when the
character encoding of the input to a form, or the character encoding of a URL, is not in UTF-8
encoding.
Returns
None
Category
International functions, System functions
Function syntax
SetEncoding(scope_name,charset)
See also
GetEncoding, cfcontent, cfprocessingdirective, URLDecode, URLEncodedFormat
History
ColdFusion MX: Added this function.
Parameters
Usage
Use this function when the character encoding of the input to a form or the character encoding of
a URL is not in UTF-8 encoding. For example, Traditional Chinese characters are often in Big5
encoding. Before using URL or Form variables, call this function (typically, in the
Application.cfm page) to set the encoding and avoid interpreting the characters of the variables
incorrectly.
For more information on character encoding, see the following web pages:
• www.w3.org/International/O-charset.html provides general information on character
encoding and the web, and has several useful links.
Parameter Description
scope_name • url
• form
charset The character encoding in which text in the scope variables is encoded. The
following list includes commonly used values:
• utf-8
• iso-8859-1
• windows-1252
• us-ascii
• shift_jis
• iso-2022-jp
• euc-jp
• euc-kr
• big5
• euc-cn
• utf-16