Jump to content
  • Advertisement
Sign in to follow this  
Daggerbot

Windows and Unicode

This topic is 3038 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Generally in Windows programming defining _UNICODE enable Unicode support in applications. Nothing I have found on MSDN specifies what the exact encoding of "Unicode" strings in the API really is. They just throw the word "Unicode" around, which itself isn't a text format. My assumption is that it is encoded in either UTF-16 or UCS-2. I read in a forum somewhere that UTF-16 is used, but I didn't really trust that these people even knew the difference between UTF-16 and UCS-2. My current project (and pretty much all of my projects for the past x years) uses UTF-8 encoded strings, and I've been wondering if the Windows API supports UTF-16 surrogate pairs. I'm not sure if my users would ever enter anything outside the basic multilingual plane, but I wouldn't want my software to crash if they do. In OS X and in Linux unicode support is effortless due to the use of UTF-8. Any C string (char *) can contain any Unicode code point, and I'm writing my game to work the same way. In particular does _wfopen take a UTF-16 encoded filename? If so then there is no problem here. Any feedback is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
The short answer is that before Windows 2000 it was UCS-2 and Windows 2000 and later are UTF-16. It's actually a bit more complicated than that, but that's the general gist of it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!