based on your variable name "wszMessage" and terminology ("UNICODE" and "ANSI"), you're dealing with Windows, and you have a UTF-16 encoded string represented as an array of 16-bit wchar_t's.
You asked for a C++ standard library approach, but because Windows does not actually support Unicode, even standard C++ approach, and even if you're converting to UTF-8, which is what most people would expect a string of "normal chars" to hold, instead of "ANSI", would still be non-portable:
This demo takes a string consisting of 4 characters, stores it in a wide string (which takes 5 wchar_t's on Windows and 4 wchar_t's everywhere else), and then converts it to UTF-8 using the standard C++ library (the result takes 10 bytes as expected of that particular string)