Migrating from CF v4.5/5 to CFMX v6.1

Posted by Dan on Oct 14, 2003 @ 4:07 PM

Ok, I've been migrating a lot of stuff from older version of ColdFusion (that were based on either C or C++) to ColdFusion MX v6.1 (which is based on Java.) I've run into several anomalies, which I thought I'd document here.

<cfdirectory>

The <cfdirectory> tag no longer returns the ./.. rows in the query. I had several applications that used <cfdirectory> and I was manually filtering out these entries by starting on the third row of the queryset. Obviously, this caused problems in the CFMX v6.1, since those records no longer exist.

Encoding Issues/Internet Explorer Rendering Issues

We found that the same exact code run under CFMX v6.1 was rendering different than the same exact code running under CF5. A little digging around and I noticed that the headers were being formatted differently. On a whim, I decided to force CFMX to return the page in "iso-8859-1" and much to my surprise, the page started rendering correctly again. Now I have no idea why the encoding of the page was causing such a drastic change in the way the page was being rendered, but the adding the following code to my application.cfm templates fixed the problem for me:

<cfprocessingdirective pageencoding="iso-8859-1">
<cfset setEncoding("form","iso-8859-1")>
<cfset setEncoding("URL","iso-8859-1")>
<cfcontent type="text/html; charset=iso-8859-1">

Structure Keys No Longer In Alphabetically Order

I know Macromedia/Allaire never made promising about this, but structure keys are no longer returned in alphabetical order when using <cfloop collection="">. I resolved this by creating a UDF to sort the keys alphabetically and returning them as a list. Here's the UDF:

// General UDF library
function getStructKeys(stStruct){
    return listSort(structKeyList(stStruct, ","), "textnocase", "asc", ",");
}

I then changed the <cfloop> from:

  <cfloop key="k" collection="#stData#">

to:

  <cfloop key="k" list="#getStructKeys(stData)#">

Problem solved.

Fortunately, these issues are really the only ones I've run in to so far. Overall, the conversions have been relatively easy.

Categories: HTML/ColdFusion

1 Comments

  • got another one for you...

    CFLOCATION "AddToken" Parameter
    the default value of 's AddToken parameter has changed from false to true. In my case, this caused the CFID and CFTOKEN to be automatically appended to the URL string every time I invoked the tag. Had to do a big find/replace to add "AddToken=false" to every instance of in the site.

    This is not a bug... just a change... but I was annoyed that it's not in the 6.1 docs... only in the release notes.

Comments for this entry have been disabled.