All application need multi language support then why Microsoft visual studio have two type of character set's
please clarify me, thanks in advance.
All application need multi language support then why Microsoft visual studio have two type of character set's
please clarify me, thanks in advance.
First, it's not just Microsoft. C++03 required two character
sets. (Formally, I think they can be identical, but I don't
know of an implementation on a general purpose machine where
they are.) C++11 requires 4 (std::string
, std::u16string
,
std::u32string
and std::wstring
); regretfully, it doesn't
require u16 and u32 versions for the iostream (but that will
doubtlessly come).
Different applications have different trade-offs. In the
application I'm currently working on, we restrict the character
set to what was traditionally called ASCII, so wchar_t
would
just make things bigger (and so things down, because of less
locality). In the text applications I do (or did) on my own
time, I used UTF-8 internally; it's no more complex than UTF-16,
and for what I do (where international characters are only
allowed in a few specific contexts), also requires a lot less
space. If I were doing full text processing (say an editor),
I'd almost certainly use UTF-32.
As it happens, the choice of 16 bit wchar_t
turned out to be
a bad choice, as full Unicode requires at least 21 bits. (When
Microsoft made the choice, of course, it seemed like the best
idea, since Unicode was still 16 bits.) Most other systems
(which adopted Unicode much later) have a 32 bit wchar_t
.
(The exception is IBM, which also adopted Unicode very early.)