I've been trying to convert between UTF8 and UTF16 LE with BOM using C++ to make the characters output correctly on Windows, without having to change the font of the terminal.
I tried changing the code pages, but they didn't work.
I have 2 questions,
- How can I convert a normal string to a wide string?
- Is it a bad idea to create a C++ map that maps each unicode character to the character in the Windows code page?
For example,
wcout << L"\u00A0" << endl;
This code outputs the letter á
on Windows when using Code page 850. How can I put a variable in place of the "\u00A0"
to convert a normal string to a wide character on Windows?
What I'd like is this:
wcout << Lsome_variable << endl;
I realise it's not valid c++ syntax but does anyone know how I can do this? Or if there's a better way?