As you may remember, windows notepad has encoding ability in "Save As.." function: as ASCII(default), UTF-8, Unicode and Big Endian. I need to make a program, which does smth with text of ASCII .txt file and saves result as Unicode .txt file.
- As i searched, Unicode here means UTF-16LE (without BOM). If i'm wrong - correct me pls.
I tryed to read from ASCII as char and convert it to wchar_t one by one - successfully, but i have UTF-8 instead of UTF-16LE. That's how i do it:
int result = (int)input_char; //input_chat is char from ASCII while(result<0) result+=256; wchar_t output_wchar = wchar_t(result);
This code works file and doesn't lose any ASCII symbols.
- Also i know that UTF-16LE is coded as U+hhhh code. So, if te previous step are right, my problem is: how to put U+hhhh code to wchar_t in c++?