🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Unicode

Started by
2 comments, last by Sinner_Zero 22 years, 7 months ago
So I''m reading this book on Win32 and all, Programming Windows, and this guy has his whole second chapter devoted to unicode, unicode, and more unicode! So here''s the question, how many people (you yourself or that you know) actually use unicode and it''s special functions or at least know them? Cuz personally I wouldnt mind using them and all if it helps the world just a little bit, you know, not that my code is important but if I ever do share it..........heh.......heh..... =/
Advertisement
UNICODE is for the support of extended character codes, for languages such as Korean and Japanese (and others that may yet to be encoded.) If you''ve ever had to deal with internationalized software, UNICODE is essential. One of my former employers developed a text-to-speech system that supported several languages (including Chinese, Japanese, Korean, Portuguese, German, Parisian and Canadian French, US and British English among others.) For such an application, UNICODE is indispensable.
Ok, so just know it, and use it if it ever might be necessary, thnx. Makes sense =P

duhhhhhhhhhhhhhhh............. heh heh.
If you''re careful, you can use the definitions in tchar.h to make it possible to compile for both Unicode and ANSI with a simple #define. This is good because under Windows NT operating systems (which means NT, 2000 and XP and any newer OS that MS releases in the future) uses Unicode internally. Any system calls in where you pass strings must have any ANSI strings converted to Unicode first. That''s quite a bit of overhead usually, so compiling you application with Unicode is a good idea since it removes the overhead. On Windows 9X systems, the reverse is true and compiling ANSI removes the overhead of converting from Unicode.

There is a "Unicode pack" for Windows 9X that actually uses the Unicode version, though, so it can''t be all bad...

Anyway, to use tchar.h you just do something like this:

  #include <tchar.h>int _tmain( int argc TCHAR **argv ){    _tprintf( _T("Hello World!\n") );}  


Basically, change all references to "char" into "TCHAR" and put a _T() around all your strings. Most of the string function you just prepend a _t to, but some of them are a bit different (like _tcslen() instead of strlen() or _stprintf() instead of sprintf(), etc). The documentation tells the name of the _T version of the function (just look up the ANSI name).

All the Win32 functions keep the same name since internally they''re redefined to either MessageBoxA or MessageBoxW (or whatever) anyway.

codeka.com - Just click it.

This topic is closed to new replies.

Advertisement