
Vladimir Batov wrote:
I think it would be sufficient to rely on the locale to make decisions about the char nature. I have solved this particular task in Boost.Log. You may find it in boost/log/detail/code_conversion.hpp and libs/log/src/code_conversion.cpp, if you're interested.
Andrey, thank you for the pointer. I'll definitely have a look. I am somewhat cautious though due to past experience. Back then we had OpenLDAP on Windows. That is, for all internal purposes we used the platform's coding -- MBCS. However, for anything OpenLDAP-related we had to handle UTF8 as heavily. That is we had to have explicit UTF8<->MBCS<->WIDE and could not rely on any support from locale.
The locale can be adjusted, if needed. One only has to substitute the codecvt facet in the locale to use different encoding rules. I think that your particular UTF8<->MBCS<->WIDE case could have been solved this way, too.