July 13, 2004

Character Encoding

Character encoding is CF is a fun thing. If you need to pass variables to java functions that require a different coding standard try manipulating the variable.

First set the variable up in either form or url scope
<cfset FORM.stringvalue = "password string">

Then set the encoding to your desired flavor:

<cfscript>
SetEncoding("FORM", "iso-8859-1");
WriteOutput("FORM.stringvalue is " & FORM.stringvalue & "
");
</cfscript>

Posted by Elyse at July 13, 2004 10:42 PM | TrackBack
Comments

I tried these 2 following possibilities, but none worked fine;

SetEncoding("url", "iso-8859-1");


Do-you have something to suggest to me ?

Tks
Daniel

Posted by: Daniel Melo at July 14, 2004 2:07 PM

Hi,

If you have java version 1.4.2 or above then the encoding server wide should be read/write. You can add the flag to the jvm.config file in the <cfmxroot>\runtime\bin folder

Under java.args= <%something in file%>
-Dfile.encoding=iso-8859-1

HTH,
Anticlue

Posted by: Elyse at July 14, 2004 6:57 PM