Friday, July 3, 2009

OT: Null Characters Bring out the Beast

Once every blue moon, I am reminded of the fact that you cannot create a null character in ColdFusion. At least not in any of the ways you would expect.

When the moon rises, I quickly run through the logical possibilities chr(0), javacast("char", chr(0)), etcetera. Only to find they do not work. Each new attempt producing everything from a space character to an empty string. But no null character in sight.

As my frustration grows, my nails begin to lengthen. My flesh erupts in fur and my teeth transform into fangs. My nails gouge the keyboard as I begin to howl. Then I remember. There is a way. Somewhere in the tombs of google there is an ancient article on Null Characters in ColdFusion.

Searching google as quickly as my claws will allow, I find it. My fangs begin to recede. I try it. My fur transforms back into flesh. It works. I am safe for another few years.

Good thing too, because trying type with claws is pretty rough on the average keyboard. Well, I am off to the computer store to buy a new one. Maybe I will pick up two .. just in case.

(Yes, it has been that kind of a day. Grrrr)

2 comments:

Tom July 13, 2009 at 12:42 PM  

I believe you are looking for JavaCast("null", 0).

This is the 'official' way to get a null in ColdFusion. See http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_in-k_45.html#1106957

cfSearching July 13, 2009 at 12:56 PM  

@Tom,

I really wish it were that easy :/ I was trying to produce an null character (ascii 0) rather than a plain null. They really make you work for this one ;)

-Leigh

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Header image adapted from atomicjeep