I\'m working with unicode/wide characters and I\'m trying to create a toString method (Java ::toString equiv). Will ostream handle wide characters, if so is there a way to w
Wide strings are non-portable and better be avoided in C++. They can be UTF-16, UTF-32 or even non-Unicode depending on platform.
The common approach in C++ is to use UTF-8 encoded multibyte char
strings internally and, if necessary, do transcoding at system boundaries. Most modern systems such as Linux and macOS work well with UTF-8 so passing them to an output stream works. Windows is the most problematic because of legacy code pages. You can use Boost Nowide or the {fmt} library for portable UTF-8 output.
Disclaimer: I'm the author of {fmt}.