I'm wondering what the Stack Overflow community thinks when it comes to creating a project (thinking primarily c++ here) with a unicode or a multi-byte character set.
Are there pros to going Unicode straight from the start, implying all your strings will be in wide format? Are there performance issues / larger memory requirements because of a standard use of a larger character?
Is there an advantage to this method? Do some processor architectures handle wide characters better?
Are there any reasons to make your project Unicode if you don't plan on supporting additional languages?
What reasons would one have for creating a project with a multi-byte character set?
How do all of the factors above collide in a high performance environment (such as a modern video game) ?
Unicode has the explicit aim of transcending the limitations of traditional character encodings, such as those defined by the ISO/IEC 8859 standard, which find wide usage in various countries of the world but remain largely incompatible with each other.
Unicode is a 16-bit character encoding, providing enough encodings for all languages. All ASCII characters are included in Unicode as widened characters. Support for a form of multibyte character set (MBCS) called double-byte character set (DBCS) on all platforms. DBCS characters are composed of 1 or 2 bytes.
Unicode is the universal character encoding used to process, store and facilitate the interchange of text data in any language while ASCII is used for the representation of text such as symbols, letters, digits, etc. in computers. ASCII : It is a character encoding standard for electronic communication.
Two issues I'd comment on.
First, you don't mention what platform you're targeting. Although recent Windows versions (Win2000, WinXP, Vista and Win7) support both Multibyte and Unicode versions of system calls using strings, the Unicode versions are faster (the multibyte versions are wrappers that convert to Unicode, call the Unicode version, then convert any returned strings back to mutlibyte). So if you're making a lot of these types of calls the Unicode will be faster.
Just because you're not planning on explicitly supporting additional languages, you should still consider supporting Unicode if your application saves and displays text entered by the users. Just because your application is unilingual, it doesn't follow that all it's users will be unilingual too. They may be perfectly happy to use your English language GUI, but might want to enter names, comments or other text in their own language and have them displayed properly.
You are talking about the VC++ Project setting here, right?
The only thing it affects is the version of Win32 API calls it ends up being exectuted. For instance, a call to MessageBox
will end up as a call to MessageBoxA
in case of the multi-byte setting, and MessageBoxW
in case of Unicode setting. Of course, that will affect the types of string parameters to that functions as well. Internally, MessageBoxA
calls MessageBoxW
after converting the string paramteres from the current system locale to Unicode.
My advice is to use the Unicode settings and pass Unicode strings to Win32 API calls. That does not stop you from using strings in any other encoding internally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With