Article Preview
Buy Now
FEATURE
Understanding Encodings
A Guide for the Perplexed
Issue: 2.2 (October/November 2003)
Author: Matt Neuburg
Author Bio: Matt Neuburg is the author of
Article Description: No description available.
Article Length (in bytes): 24,787
Starting Page Number: 23
Article Number: 2211
Related Web Link(s):
http://developer.apple.com/documentation/Carbon/Conceptual/ProgWithTECM/tecmgr_concepts/
http://www.unicode.org/
Excerpt of article text...
Judging from some of the messages on the REALbasic mailing lists, many people seem to be perplexed about encodings in REALbasic 5. However, there's no need to be. Most of those asking for help seem guilty of going to one extreme or the other -- either of worrying needlessly about encodings, as if they were some sort of all-pervasive and dangerous mystery to be guarded against at every instant, or else of failing to admit that they exist at all. This article is intended to help you walk a middle path, so that you can be aware of encodings without losing any sleep over them.
The Text Myth
It is perfectly natural to suffer from a delusion that there is text in your computer. Well, this may come as a shock to you, but sometimes a little shock is a good thing, so here goes: in the mind of your computer, there is really no such thing as text. The only thing your computer knows about is numbers.
The reason you are lulled into this belief that your computer knows about text is that sometimes your computer manipulates numbers in such a way that they behave like text. In order for your computer to do this, there must be a set of rules for translating between numbers and text. For example, we could decide that 1 means "a", that 2 means "b", and so forth; or we could decide that 100 means "a" and 200 means "b". It really doesn't matter what rules we decide upon, as long as we are clear on what rules we're using. It's all entirely arbitrary, rather like one of those secret codes you probably made up when you were a kid.
An
encoding is simply a set of rules for performing this kind of translation. An encoding mediates between a sequence of numbers (orbytestream ), on the one hand, and the visually representable textual characters (orglyphs ) on the other. So you can see right away that encodings are not something to be afraid of; they're something to be grateful for. Without encodings, your computer wouldn't be able to do text at all.So why all the fuss? There are two reasons. First, there can be any number of encodings, and historically, in fact, a very large number of them have been devised. Second, although, in the past, you may have ignored the matter of encodings, you can't do that any longer: in REALbasic 5, encodings matter.
...End of Excerpt. Please purchase the magazine to read the full article.