Handling data in ColdFusion MX
383
General character encoding issues
Applications developed for earlier versions of ColdFusion that assumed that the character length
of a string was the same as the byte length might produce errors in ColdFusion MX. The byte
length of a string depends on the character encoding.
Locale-specific content
The following sections provide information on how to handle locale-specific content in pages that
support multiple locales, and how to handle euro values.
Generating multi-locale content
In an application that supports users in multiple locales and produces output that is specific to
multiple locales, you call the
SetLocale
function in every request to set the locale for that specific
request. When processing has completed, the locale should be set back to its previous value. One
useful technique is to save the user’s desired locale in a Session variable once the user has selected
it, and use the Session variable value to set the locale for each user request during the session.
Supporting the euro
The euro is the currency of many European countries, and ColdFusion supports the reading and
writing of correctly formatted euro values. Unlike other supported currencies, the euro is not tied
to any single country (or locale). The
LSCurrencyFormat
and
LSParseCurrency
functions rely
on the underlying JVM for their operations, and the rules used for currencies depend on the
JVM. For Sun JVMs, the 1.3 releases did not support euros and used the older country-specific
currencies. The 1.4 releases use euros for all currencies that are in the euro zone as of 2002. If you
are using a JVM that does not support the euro, use the
LSEuroCurrencyFormat
and
LSParseEuroCurrency
functions to format and parse euro values in locales that use euros as their
currency.
Input data from URLs and HTML forms
A web application server receives character data from request URL parameters or as form data.
The HTTP 1.1 standard only allows US-ASCII characters (0-127) for the URL specification and
for message headers. This requires a browser to encode the non-ASCII characters in the URL,
both address and parameters, by escaping (URL encoding) the characters using the “%xx”
hexadecimal format. URL encoding, however, does not determine how the URL is used in a web
document. It only specifies how to encode the URL.
Form data uses the message headers to specify the encoding used by the request (Content headers)
and the encoding used in the response (Accept headers). Content negotiation between the client
and server uses this information.
This section contains suggestions on how you can handle both URL and form data entered in
different character encodings.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......