I'm double-posting today as I spotted this whilst writing up the example code for the previous article.
Thanks to the Maori days of the week having a macron over some of the As, I need to give the ColdFusion compiler a bit of a nudge to explain to it to treat the source code file as UTF-8, not the default of [whatever it is]. It's a bit sh!t that one still needs to do this in the 21st Century, given even NotePad.exe can determine the encoding scheme of a file without being explicitly told, but such is the ways of ColdFusion (view for this bug please: 3342141!).
Anyway, I need that <cfprocessingdirective> tag in there. Breaking my nice script-only code. Suck:
<cfprocessingdirective pageEncoding= "UTF-8">
<cfscript>
daysOfTheWeek = queryNew(
"id,english,maori",
"Integer,Varchar,Varchar" ,
[
// etc
But wait! On the weekend I was reading up the docs for how something else was implemented for CFScript compatibility, and I came across this:
Specifying page encoding
You can specify the character encoding of a component by specifying a pageencoding processing directive at the top of the component body. You can specify the pageencoding directive only for components. The following code snippet shows how to use the directive:
// this is a component
// this is a component /** *@hint "this is a hint for component" */ component displayname="My Component" { pageencoding "Cp1252" ; // // The rest of the component definition goes here. // }
So when looking at this I spotted the yellow bit, but I only just now spotted the orange bit.
The orange bit is what's causing me to shake my head in disbelief.
I was knocking out my example code for this morning's example, and had this:
<cfscript>
pageEncoding "UTF-8";
daysOfTheWeek = queryNew(
"id,english,maori",
"Integer,Varchar,Varchar" ,
[
// etc
And this breaks. And now I have seen the orange warning, I understand why.
But steady on here. I choose my words very carefully with my reaction to this. Here are the words I've chosen:
WHAT THE ... THE... WHAT THE HELL?
Why on Earth would they implement the pageEncoding directive only for CFCs? What was the thinking there? So, what, we've now got special statements that only work within a CFC? That's lunacy. And surely it's actually more work to make it only work in a CFC than it is to have it just work?
So... yeah. I've raised 3344090 to get this sorted out.
That really bites.
--
Adam