views:

74

answers:

2

By referring Joel's Article

Some people are under the misconception that Unicode is simply a 16-bit code where each character takes 16 bits and therefore there are 65,536 possible characters. This is not, actually, correct.

After reading the whole article, my point is that, if someone told you, his text is in unicode, you will have no idea how much memory space taken up by every of his character. He have to tell you, "My unicode text is encoded in UTF-8", then only you will have idea how much memory space is taken up by every of his character.

Unicode = not necessary 2 byte for each character


However, when comes to Code Project's Article and Microsoft's Help, this confused me :

Microsoft :

Unicode is a 16-bit character encoding, providing enough encodings for all languages. All ASCII characters are included in Unicode as "widened" characters.


Code Project :

The Unicode character set is a "wide character" (2 bytes per character) set that contains every character available in every language, including all technical symbols and special publishing characters. Multibyte character set (MBCS) uses either 1 or 2 bytes per character

Unicode = 2 byte for each character ?

Is 65536 possible characters able to represent all language in this world?

Why the concept seems different among web developer community and desktop developer community?

+4  A: 

Once upon a time,

  • Unicode had only as many characters as fit in 16 bits, and
  • UTF-8 did not exist or was not the de facto encoding to use.

These factors led to UTF-16 (or rather, what is now called UCS-2) to be considered synonymous with “Unicode”, because it was after all the encoding which supported all of Unicode.

Practically, you will see “Unicode” being used where “UTF-16” or “UCS-2” is meant. This is a historical confusion and should be ignored and not propagated. Unicode is a set of characters; UTF-8, UTF-16, and UCS-2 is an encoding.

(The difference between UTF-16 and UCS-2 is that UCS-2 is a true 16-bits-per-“character” encoding, and therefore encodes only the “BMP” (Basic Multilingual Plane) portion of Unicode, whereas UTF-16 uses “surrogate pairs” (for a total of 32 bits) to encode above-BMP characters.)

Kevin Reid
OK. So, in the above content, unicode means "unicode encoded in UTF-16", and it it not necessary 16 bit per character, and it can more than that. am I right?
Yan Cheng CHEOK
and How about MBCS?
Yan Cheng CHEOK
It is true that UTF-16 is not a fixed-width encoding, due to its use of surrogate pairs. — You will have to determine from other sources or experiment whether the data they call “Unicode” is actually UTF-16 (can have surrogates and represent all of Unicode) or UCS-2 (cannot have surrogates; can only represent the BMP portion of Unicode). — I have no information on the term “MBCS”.
Kevin Reid
A: 

To expand on @Kevin's answer:

The description is Microsoft's Help is quite out of date, describing the state of the world in the NT 3.5/4.0 timeline.

You'll also occasionally see UTF-32 and UCS-4 mentioned as well, most often in the *nix world. UTF-32 is a 32-bit encoding of Unicode, a subset of UCS-4. The Unicode Standard Annex #19 describes the differences between them.

The best reference I've found describing the various encoding models is the Unicode Technical Report #17 Unicode Character Encoding Model, especially the tables in section 4.

devstuff