Ask a Jedi: Foreign text over CFDIV

Darren asks:

I've currently got an issue with cfdiv. I have a European site translated into lots of different languages, what seems to be happening is the html content, specifically the accents are not being encoded correctly in our favorite browser Internet Explorer! All other browsers are fine, the server is cf8 not 9 so I don't know if this would jave been fixed or not.

I tried adding cfcontent inside the template to force it (another devs suggestion) but it didn't make any diff, just wondered if you had any other ideas about it other than ripping out cfdiv an using jquery, though I don't know if this would be the case for any ajax request.

So I'm no localization expert, that would be Paul Hastings, but I did have an idea as to what was wrong here. I began with two quick CFMs, one a client that would use Ajax to load the other. The second page would have my foreign text in it. Here is the first page.

<h2>Parent Page</h2> <cfdiv bind="url:test3.cfm">

Yeah, that's it, but it's enough to recreate our page. Now our second page:

Me permettez-vous, dans ma gratitude pour le bienveillant accueil que vous m'avez fait un jour, d'avoir le souci de votre juste gloire et de vous dire que votre étoile, si heureuse jusqu'ici, est menacée de la plus honteuse, de la plus ineffaçable des taches ?

No code there, just French text. I've forgotten 95% of my high school and college French, so if that's something offensive, please pardon the French. (Heh, sorry, couldn't resist.) I "fixed" this by simply adding a processing directive to the page.

<cfprocessingdirective pageencoding="utf-8">

This sets the encoding value for the page which helps the response render right in the browser. I still find a lot of localization stuff voodoo, but I was surprised to find that Adobe has a ColdFusion Localization "center" - http://www.adobe.com/devnet/coldfusion/localization_globalization.html. It's a grand total of four articles, but it may be a good starting point for folks.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments