In the beginning, there was
ASCII, and things were simple. But they weren't good, for no one could write in
Cyrillic or Thai. So there exploded a proliferation of character encodings to
remedy the problem by extending the characters ASCII could express. This
ridiculously simplified version of the history of character encodings shows us that
there are now many character encodings floating around.
A character encoding tells
the computer how to interpret raw zeroes and ones into real characters. It
usually does this by pairing numbers with characters.
Information on a computer is
stored and transmitted in what are called bits. Certain bits or combinations of
bits equate to certain characters.
...The "charset"
parameter identifies a character encoding, which is a method of converting a
sequence of bytes into a sequence of characters. This conversion fits naturally
with the scheme of Web activity: servers send HTML documents to user agents as
a stream of bytes; user agents interpret them as a sequence of characters. The
conversion method can range from simple one-to-one correspondence to complex
switching schemes or algorithms...
There are many different types
of character encodings floating around, but the ones we deal most frequently
with are ASCII, 8-bit encodings, and Unicode-based encodings.
·
ASCII is a 7-bit encoding based on the English alphabet.
·
8-bit encodings are extensions to ASCII that add a potpourri of
useful, non-standard characters like é and æ. They can only add 127 characters,
so usually only support one script at a time. When you see a page on the web,
chances are it's encoded in one of these encodings.
·
Unicode-based encodings implement the Unicode standard and include UTF-8,
UTF-16 and UTF-32/UCS-4. They go beyond 8-bits and support almost every
language in the world. UTF-8 is gaining traction as the dominant international
encoding of the web.
Why do I need Character Encoding?
You need to include character encoding because:
- The
declaration of character encoding is required as of the HTML 4.01
specification.
- When
a browser renders/parses a web document that does not have the character
encoding declared it will guess at what character set to use and may
choose the wrong one therefore rendering the web page incorrectly.
- The
visitor may have changed the default character encoding on their machine
(Internet Explorer: View, Encoding) and it may not match the character
encoding intended for the web document.
- It
helps speed up your web pages.
When choosing a character encoding choose one that will be
versitle, covering all the different languages and requirements of your
intended audience. Unicode
(UTF-8) is a very versitle character encoding to choose
No comments:
Post a Comment