é becomes é

Last night, I had an interesting problem tossed my way. Background: For some reason, an application built in ASP with FCKEditor instances running on some pages was mangling special characters on display and update. The ASP page that was causing this issue had an include of the FCKEditor.asp on it. Removal of that include file from the ASP page did not cause the mangling. However, just including the file (even if the FCKEditor instance itself was not created) seemed to mangle any special characters put on the page.

For e.g: special characters like (Alt-0233 etc) "é" was getting converted into é as shown in the picture to your left.  

 

This was peculiar because of data that was stored in the database for working conditions did not seem to be mangled. For some reason, the request and the response data seemed to be mangling it. (That should have tipped me off right then and there ;)

Anyways, I started looking into FCKEditor.asp to see if there was any rewrites going on and sure enough, there was this function call that seemed to be iterating through the DOM elements in the response and rewrite portions of it. At first glance, it seemed as though that was it. However, the FCKEditor instance was NOT getting created on that page! Only the include was a part of the page structure. So, what gives?

After spending a couple hours trying to further troubleshoot it, I called it a day and went home. It was still bugging me in the back of my mind that I had come across something similar before, but just could not remember what the fix was. Came back in the morning, fired up the app and started testing it from scratch and then it struck me. Maybe it was not FCK. Maybe there was some encoding issues with either the files themselves or the server looking at character encoding sets and making some adjustments.

I ruled the server out (as in most cases) it only does what it is told. If it was mangling the response then something was telling it. (BTW, I used Charles Debugging Proxy last night to determine if the request headers and response headers were doing anything. A neat and handy tool except for the annoying shareware feature that turns the tool off every 30 minutes)

Armed with that information, I looked at the files themselves and bingo! The application ASP files were encoded in ANSI format while the FCKEditor.asp was encoded in UTF-8.

Changed the type on the FCKEditor file to match the encoding for the rest of the app files and it started working! So, moral of the story, LOOK before you LEAP!

Cheers!



Comments are closed

Tat Tvam Asi

Sanskrit: तत् त्वम् असि or तत्त्वमसि) translating variously to "Thou art that" "That thou art" or "That you are"

A Word a Day

Affiliations