| Start |
|---|
Understanding C++ string characteristics Depending on platform (windows, OSX, etc) and compiler (GCC, MSVC, etc), this program may fail to compile, display different values, or display the same values. Example output under the Microsoft MSVC compiler: String Length: 31 This shows that under MSVC each of the extended-characters used is considered a single "character", and this platform fully supports internationalised languages. Under the GNC/GCC compiler the program output is: String Length: 31 This example demonstrates that while the GCC compiler used on this (Linux) platform does support these extended-characters, it also uses (correctly) several bytes to store an individual character. These differences are due to how international languages are handled on a per-platform basis - and more importantly, that the C and C++ strings used in this example can be considered an array of bytes, such that (for this usage) the C++ language considers a character (char) to be a single byte. RemarksThe C++ language does not dictate any character-set, some compilers may support the use of UTF-8, or even UTF-16. However there is no certainty that anything beyond simple ANSI/ASCII characters will be provided. Thus all international language support is implementation defined, reliant on what platform, operating system, and compiler you may be using. Several third party libraries (such as the International Unicode Committee Library) that can be used to extend the international support of the platform. |
Read Article
https://develop.horje.com/learn/1434/reference