Wordpress strange characters

wordpress

#1

On my Wordpress blog hosted with Dreamhost I seem to be getting some strange charaters from time to time that replace quotes and things like that. For example, if I wrote “hi, I’m Kelly’s webpage.” the ’ in I’m and Kelly’s comes out with weird characters.
Anyone know how to fix this, or what causes it?
Website is: kellymarsh.net

Thanks


#2

Did you copy and paste the text from your local computer? I know that sometimes odd characters such as smart quotes don’t translate well to a website.

Another thought is PHP’s smart quotes, with which I’m completely unfamiliar. Maybe someone else can shed some light on how PHP processes odd characters.

-Scott


#3

It sounds like a releatively common problem that is encountered when UTF-8 encoded characters are displayed using the ISO-8859-1 encoding. I generally see this happen when something is “cut” from a UTF-8 encoded web page and subsequently “pasted” into a form field where the page is ultimately displayed with the ISO-8859-1 encoding.

You can experiment a bit with your browser by changing the encoding used (In IE and Firefox, the setting is under the “View” pulldown menu).

If that is indeed the problem, the fix is to make sure you pages are served using the appropriate character set with the

tag where "UTF-8" is set to the appropriate character set.

Alternately, you can “convert” the UTF-8 characters after “cutting” via several free clipboard tools, or an editor with that capability, before “pasting”.

–rlparker


#4

WordPress deliberately does this conversion. Annoying, eh? See http://wordpress.org/support/topic/24408 for how to disable the conversion (although things may have changed in current versions of WordPress, so you may have to search the WordPress forums a bit).


#5

To add more to what rlparker was saying, your pages are being served with no content-type specified. That means it is up to the browser to decide what character set to use. For me, it uses UTF-8, so your page looks fine. For you, it may be using 8859-1, causing smart quotes to look like O’s with tildes over them or something else strange. The built-in editor for WP will create smart quotes, which is probably why you are having trouble. Check your setting under Option, Reading, “Encoding…” It could be that is set to UTF-8 but you’re using a modified theme that does not transmit the correct meta tag. Either way, I’d suggest making sure that setting is UTF-8 and that you are sending the correct meta tag as rlparker showed.

Check out Gordaen’s Knowledge, the blog, and the MR2 page.


#6

The meta tag is actually the “cheap plastic” way of imitating the correct way to specify the character encoding of a web page, which is to have the HTTP server send the correct headers in the first place (e.g., through .htaccess files).

– Dan


#7

Can you elaborate on how this is done. I have .htaccess, but I don’t know what I need to include to have this work. Thanks.


#8

Put in the line:

AddDefaultCharset ISO-8859-1

with whatever character encoding you want to use.

– Dan