
Reece Dunn wrote:
Vladimir Prus wrote:
Adam Badura wrote:
I looked on a few GUI C++ libraries, but none of them satisfied me. Most commonly of this reasons: 1) weak support if at all for exceptions (wxWidgets for example) 2) using own classes instead of standard (most common for string) (wxWidgets and MFC for example)
Well, given that std::basic_string's support for Unicode is lacking, I would consider using custom string class an advantage of those libraries. Hey, you can't even convert std::string to std::wstring, and you can't construct std::wstring from char*. Can you convert std::wstring to any of Unicode's normalization forms? How portable is reading of std::wstring from a file with specific 8-bit encoding?
WRT the MFC/ATL/WTL libraries, they use the Win32 API calls WideCharToMultiByte (WC2MB) and MultiByteToWideChar (MB2WC) to do the conversion using the current thread's codepage. Likewise, their CA2W/CW2A helper classes do a similar thing.
The WC2MB/MB2WC API allow you to pass in a specific codepage (not just the current thread/user's). Some of these include: UTF7 = 65000 UTF8 = 65001 UTF16 (Little Endian) = 1200 UTF16 (Big Endian) = 1200
So, you could say something like:
std::cout << unicode_cast< std::string >( russian_text, unicode::utf8 );
Sure, but there's no "std::" in front of "unicode_cast". In fact, I don't know what the "unicode_cast" comes from. My points is not that you cannot implement all the missing functionality for std::string. The point is that std:: namespace does not have this functionality.
I am not sure about how this would work for Linux, Mac and other operating systems, though.
Assuming unicode_cast is from MFC/ATL/WTL -- then well, none for Linux. - Volodya