In my current project I’ve been using wide chars (utf16). But since my only input from the user is going to be a url, which has to end up ascii anyways, and one other string, I’m thinking about just switching the whole program to ascii.
My question is, is there any benefit to converting the strings to utf16 before I pass them to a Windows API function?
After doing some research online, it seems like a lot of people recommend this if your not working with UTF-16 on windows.
The main point is that on Windows UTF-16 is the native encoding and all API functions that end in
Aare just wrappers around theWones. TheAfunctions are just carried around as compatibility to programs that were written for Windows 9x/ME and indeed, no new program should ever use them (in my opinion).Unless you’re doing heavy processing of billions of large strings I doubt there is any benefit to thinking about storing them in another (possibly more space-saving) encoding at all. Besides, even an URI can contain Unicode, if you think about IDN. So don’t be too sure upfront about what data your users will pass to the program.