Name

SetEncoding

Synopsis

                  
                  SetEncoding("Form|Url", charset)

Sets the character encoding for form or URL variables to charset when the submitted form or URL data is not in Latin-1 encoding. charset lets you specify a Java character set to use for the encoding. The most common character sets are UTF-8 (the default), UTF-16, UTF-16BE, UTF-16LE, US-ASCII, and ISO-8859-1. You may use any character set supported by your JRE. The following example assumes the page is receiving a form post with form field data that is not Latin-1 encoded. Is simply sets the encoding to UTF-8 and dumps the form scope to the browser:

<cfset SetEncoding("form", "UTF-8")>
   
<cfdump var="#form#">

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.