My team is having trouble serving HTML pages that contain special characters (accented French e.g. été).
On some of our pages it works fine, but on most it displays 'été' as 'Ã©tÃ©'. I have been unable to isolate the issue though I expect it is nested in the server somewhere.
I say this because if I load the same HTML page from two separate URLs one displays characters correctly, and the other does not.
The files on the server are exactly the same, but on the client side the accented characters do not display.
This leads me to the conclusion that it isn't something to do with content-type or other header data, but rather the server has decided not to interpret the characters correctly.
I'm open to suggestions.
When you say this:
if I load the same HTML page from two separate URLs one displays characters correctly, and the other does not.
Do you mean the URLs point to the very same file, or just two files that are "the same" (if it's two files, they're clearly not the same ;-)
Where's the text that's not rendering sourced from? Is it from the DB or hard-coded in your source code? You might have to tell your JDBC connector to use unicode if it's coming from the DB; if it's in a file, then you need a <cfprocessingdirective> at the top of the file to tell CF to compile it as unicode, not ascii.
If you're testing with two separate files, I suspect one is saved with UTF-8 encoding, and one without. You can check this by opening them in notepad, and going save-as (you don't need to actually save it). It'll tell you which encoding the file is saved using.
So it was two separate files with the same content, not the same file from two URLs, and you are right to point that out. However, both were encoded as ANSI.
Saving the files as Unicode (not UTF-8) through Notepad got them working consistently, and the cfprocessingdirective tag did not make a difference once this was in place.
Thanks for putting me on the right track Adam.
I'm hesitant to leave it to CF to work out a file's encoding, and always let it know with the <cfprocessingdirective>: I've had mixed results without it.
But mileage varies, so up to you.
Europe, Middle East and Africa