Wednesday, February 10, 2010

The Importance of Character Encodings

I'm amazed at how many non-supported characters I see out on the Web. I spent a long time researching and deciphering just how to use the proper character encoding so that this doesn't happen to you. You can read all about it in Chapter 21, Symbols and Non-English Characters, of my HTML, XHTML, and CSS: Visual QuickStart Book.

Doing some research on Barnes and Noble's new electronic book reader, the nook, I saw this:
Wrong Character Set on Barnes and Noble site

Looking at the source code, you can see that B&N did not declare their character encoding. Firefox assumed it was UTF-8, but since it wasn't, the special symbols display incorrectly. If you're just a Web site visitor and want to see the page without those annoying question marks, go to View > Character Encoding, and choose a different encoding from the one Firefox tried originally. If that happens to match the character encoding that the Web site creator used, you're in luck. If not, try again until you find it.

If you're a Web site designer, be sure and declare your page's Character Set so that browsers don't have to guess. At the top of your page, put:

<meta http-equiv="content-type" content="text/html;charset=code" />

where code is the character set encoding you used to write your page. I explain how to tell which one you used (and how to choose an appropriate one if you're not already), in my book!

5 comments:

Anonymous said...

I get this issue on Yahoo News all of the time.

Jeremy

Anonymous said...

How about Peachpit Press selling a digital (pdf, etc.) edition of your new book on creating eBooks? I don't see one listed up for sale yet.

Liz Castro said...

Yes, there will be an ePub version of my book, "ePub: Straight to the Point".

Anonymous said...

this is giving me some bother. i 'm using html-kit and can't find the option to save my work in a certain encoding. i'm only just starting out and am missing something obvious I'm
sure. any help?

Liz Castro said...

I don't know "html-kit". I would recommend finding a text editor that can handle character encodings. For Mac, try BBEdit or TextWrangler. For Windows, I've heard good things about Notebook++.

My Books