File Data; Databases - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

To work around this issue, use the
input form text. The
scope and the second specifies the character encoding used by the scope. Since ColdFusion writes
form parameters to the Form scope, you specify "Form" as the scope parameter to the function. If
the input text is double-byte, ColdFusion preserves the two-byte representation of the text.
The following example specifies that the form data contains Korean characters:
<cfscript>
setEncoding("FORM", "EUC-KR");
</cfscript>
<h1> Form Test Result </h1>
<strong>Form Values :</strong>
<cfset text = "String = #form.input1# , Length = #len(Trim(form.input1))#">
<cfoutput>#text#</cfoutput>

File data

You use the
cffile
that the text that you are reading, writing, copying, moving, or appending is in the JVM default
file character encoding, which is typically the system default character encoding. For
action="Read"
file; if there is one, it uses the character encoding that the BOM specifies.
Note: To specify the JVM default file character encoding, use the
JVM Arguments field of the ColdFusion MX Administrator Java and JVM Settings page.
Problems can arise if the file character encoding does not correspond to JVM character encoding,
particularly if the number of bytes used for characters in one encoding does not match the
number of bytes used for characters in the other encoding.
For example, assume that the JVM default file character encoding is ISO 8859-1, which uses a
single byte for each character, and the file uses Shift-JIS, which uses a two-byte representation for
many characters. When reading the file, the
character, and converts it into its corresponding two-byte Unicode representation. Because the
characters are in Shift-JIS, the conversion corrupts the data, converting each two-byte Shift-JIS
character into two Unicode characters.
To enable the
cffile
character encoding, you can pass the
encoding of the data to read or write, as the following example shows:
<cffile action="read"
charset="EUC-KR"
file = "c:\web\message.txt"
variable = "Message" >

Databases

ColdFusion applications access databases using drivers for each of the supported database types.
The conversion of client native language data types to SQL data types is transparent and is done
by the driver managers, database client, or server. For example, the character data (SQL CHAR,
VARCHAR) you use with JDBC API is represented using Unicode-encoded strings.
SetEncoding
function takes two parameters: the first specifies the variable
SetEncoding
tag to write to and read from text files. By default, the
, ColdFusion MX 6.1 also checks for a byte order mark (BOM) at the start of the
tag to correctly read and write text that is not encoded in the JVM default
charset
function to specify the character encoding of
-Dfile.encoding=
tag treats each byte as an ISO 8859-1
cffile
attribute to it. Specify as a value the character
Handling data in ColdFusion MX
tag assumes
cffile
cffile
switch in the
385

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion mx

Table of Contents