Relative Content

Tag Archive for c++linuxunicode

Unicode from string literal vs from file produces strange behaviour

I’ve been struggling through unicode support in C++, and am getting strange behaviour. If I load a line of unicode text from file, I can store it inside a regular string and output it to stdout without problems. But if I use a unicode string literal with the exact same characters, I have to store it in a wstring and it fails to output properly. Why?