MSPSS: is there life after the helpdesk?

sharing solutions to uncommon IT problems

Special Characters (with French accents) displayed incorrectly

with one comment


Hello,

this post concerns a problem we’ve had on a Windows 2003 R2 SP2 machine running IIS6 and SQL Server 2000.

All of a sudden (no updates occurred in the meanwhile) some asp pages started displaying words with special characters (e.g.: Jérôme) incorrectly.

We thought straight away of some collation problem with SQL Server but the query executed on SQL Query Analyzer returned correct values.

Then we thought of some problems with the CONTENT=”text/html; charset=UTF-8″ setting and although we could tweak it a little bit it wouldn’t have been a clean fix.

So I create a brand new asp file with a simple connection and the characters were displayed correctly.

Then I added all the includes I had in the other asp file until I started getting the display error.

Once I found the “corrupted” file I tried emptying it but it would still cause the parent page to display wrong characters.

So I tried editing that page with a Hex editor (I used HHD Hex Editor Neo) and bingo! this file was prefixed by a “ef bb bf” which basically it’s a way to force some sort of encoding (check the actual definition on Wikipedia).

Once I removed that Hex string from the beginning of the file (you can simply copy the content of the page in another file) the characters were displayed correctly again.

If you think you might have more than a file with this kind of problem you can search throughout your website using a Hex File Search (I used Effective File Search)… I found 8 files with this problem.

Good night and good luck…

Zantoro.

 

Just a little update in case you run into a similar problem:

In a forum I was told to set a “Custom HTTP Header” in IIS to “CONTENT=”text/html; charset=UTF-8″”. While this didn’t fix the problem, it instead caused many problems to the website as it overwrote the charset for any other file I had on that server (e.g.: Zip files opened as text/html instead of being downloaded).

Advertisements

Written by zantoro

September 27, 2010 at 2:31 pm

Posted in IIS

One Response

Subscribe to comments with RSS.

  1. […] charset being referenced in the page. Initially I thought it could be due to the hex string problem I already wrote about some time ago but I couldn’t find said string anywhere in the […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: