views:

131

answers:

3

I have a graffiti blog and i have a strange problem which is showing strange char page like this:

alt text

This page was showing when I opened my control panel admin page. It's also showing the same when I try to edit one of my previous posts. My problem is that i don't know what's the reason behind it.

I am not sure how to fix this. All my posts are in English and I always use Windows Live Writer to post.

Has anyone faced a problem like this before? Can you advise me on finding the cause of this problem, and any potential solution?

A: 

Looks like it might be an encoding mismatch. Are you opening UTF-8 (or some other Unicode)-encoded files in a tool that doesn't understand UTF encodings or vice-versa?

DaveE
how can i know that?
Amr ElGarhy
Open the file in an editor that understands various encodings. NotePad++ is one (notepad-plus-plus.org). Even Windows' Notepad can tell you if a file is Unicode or not.If you need to use an ASCII-only editor and you see '' as the first three bytes, you've got a UTF-8 file. 'þÿ' or 'ÿþ' indicate a flavor of UTF-16.
DaveE
Amr ElGarhy
do you have access to the source? It might be if this is being saved to a database that the input isn't being converted into a compatible encoding. My company is currently going through a conversion of our SQL Server database from storing text in CP1252 to UTF-16. It's not pretty-we've had some odd data conversion errors.
DaveE
Yes i have access, so should i open the database and go through the records and check if something didn't save well?
Amr ElGarhy
Yep. Is the font you're using Unicode-capable? If there are code points in the data that your font can't display, you'll see garbage characters. If you're looking at the data directly, check to see if you have binary zeroes interspersed in the string - that's a quick-and-dirty indication that you may have unicode characters (UTF-16). Typically, though, a string value won't have the Byte Order Marks at the start, only files.
DaveE
A: 

Try placing this in your master page:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Also, check that a virtual directory has been created.

IrishChieftain
did that but nothing changed :(
Amr ElGarhy
A: 

There seems to be a problem with the content MIME-types. The weirdness you are seeing happens because the server offers content as binary (I'm guessing application/octet-stream) even though it should offer them as text/html. Images should be offered as image/<extension>, for example image/png.

You can manually set MIME-type handlers to certain filetypes. If you are using Apache, you could easily to this in a .htaccess file like this:

AddType text/html .html

If your content is something else than HTML the MIME-type is something different. If your web-server doesn't automatically do this you should probably add the handlers yourself.

All MIME-types can be found from here: http://www.iana.org/assignments/media-types/

vtorhonen