Tuesday, April 24, 2012

CFML XMLTransform() and Character Encoding

Quick tip on using CFML's XMLTransform() -- if you see fun weird characters in the output of the transformation like  and you've checked to make sure the response headers from the web server are correctly returning UTF-8, you probably just need to specify the charset of the CFFILE operations when you read the XML and XSLT files from disk.

In my case I was seeing non-breaking spaces being rendered as   which outputs a capital 'A' with a circumflex before the non-breaking space. At first I thought maybe the response from the web server was ISO-8559 for some reason instead of UTF-8 but after verifying that was correct, adding charset="utf-8" to the CFFILE tags that read the XML and XSLT files from disk, all was right with the world.

1 comment:

Paul Hastings said...

i guess something rubbed off after all ;-)