|
Nothing's more frustrating than viewing the web page that you've been coding for the last four hours and seeing... gibberish. Now, don't go throwing your computer against the wall just yet. We're here to help.
Take a deep breath and ask yourself: "Have I checked my ampersands and curly-quotes?"
See, even though Hypertext Markup Language (HTML) is used to write all of the copy you read on the web, that copy has to be written a certain way. And as you while away hours upon hours coding, it's easy to get sloppy. So if you see weird characters and other stuff that shouldn't be there, check out these possible offenders first:
Ampersand Commands
Ampersands do not usually exist by themselves in HTML code (exceptions being meta information, links and comments), because an ampersand denotes "something special".
When your browser scans a web page's code line-by-line it is constructing a page that you can see. Tags, anchors, tables, etc. exist in that code, giving shape and functionality to your page. When your browser encounters an ampersand, it looks for a snippet of code following the ampersand in order for it to properly render out the special character that it expects to be there.
So if you wanted to write out the following:
Bogin, Munns & Munns
you would type this into your HTML code:
Bogin, Munns & Munns
Your browser sees the ampersand "&", then sees the code snippet next to it "amp" (meaning "put an ampersand here") and the semicolon ";" (which ends the code snippet) and knows that what you want your viewers to see is: Bogin, Munns & Munns. If all you have is the ampersand by itself, your browser will do a "best guess" and insert whatever weird character it feels like. If you don't add the semicolon, thereby finishing the code snippet, all of the following text on the page could be rendered in gibberish.
Rich Text
There are two kinds of people in the world: Elvis fans and Beatles fans. Following that same train of thought, there are two kinds of text in the digital world: Simple text and Rich text.
Simple text is bare bones, no-frills, NON-FORMATTED text (think TextEdit on a Mac or WordPad on a PC). Rich Text is frilly, pretty, FORMATTED text (think Pages on a Mac or Word on a PC). HTML code is written in simple text, but thanks to the ubiquity of apps like MicroSoft Word, rich-text characters and symbols have a way of sneaking into your code. This usually happens when you're cutting and pasting text from a Word .doc into your HTML editor. Before you know it, your HTML editor, which isn't prepared to handle rich text, is chock full of curly quotes (only straight quotes in simple text!) and curved apostrophes. And, like the stand-alone ampersands, a browser will freak out when encountering rich text and we'll get the "best guess" and weird gibberish.
If it sounds like a lot of work to check every single line of code, have no fear: Apps like Site Soap can clean up all of your sloppy code for you, and viewers to your websites will see only what you want them to see.
|