Adobe COLDFUSION 9 Manual page 382

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
File data
You use the cffile tag to write to and read from text files. By default, the
reading, writing, copying, moving, or appending is in the JVM default file character encoding, which is typically the
system default character encoding. For
at the start of the file; if there is one, it uses the character encoding that the BOM specifies.
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
tag treats each byte as an ISO 8859-1 character, and converts it into its corresponding two-byte Unicode
cffile
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
tag to correctly read and write text that is not encoded in the JVM default character encoding,
cffile
you can pass the
attribute to it. Specify as a value the character encoding of the data to read or write, as the
charset
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.
Database administrators configure data sources and usually are required to specify the character encodings for
character column data. Many of the major vendors, such as Oracle, Sybase, and Informix, support storing character
data in many character encodings, including Unicode UTF-8 and UTF-16.
The database drivers supplied with ColdFusion correctly handle data conversions from the database native format to
the ColdFusion Unicode format. You do not have to perform any additional processing to access databases. However,
always check with your database administrator to determine how your database supports different character
encodings.
E-mail
ColdFusion sends e-mail messages using the cfmail, cfmailparam, and cfmailpart tags.
By default, ColdFusion sends mail in UTF-8 encoding. You can specify a different default encoding on the Mail page
in the ColdFusion Administrator, and you can use the
the character encoding for a specific mail message or part of a multipart mail message.
HTTP
ColdFusion supports HTTP communication using the cfhttp and cfhttpparam tags and the GetHttpRequestData
function.
, ColdFusion also checks for a byte order mark (BOM)
cffile action="Read"
attribute of the
charset
Last updated 8/5/2010
tag assumes that the text that you are
cffile
and
cfmail
cfmailpart
377
tags to specify

Advertisement

Table of Contents
loading

Table of Contents