Hi,
My program is trying to read from file Lithuanian words, the language has some additional characters than ANSII character set. The program uses wstring, wifstring classes for reading, but I gotta feeling it is something wrong with input,do I need any special directive to compiler or the language has to be installed in machine? I am sorry I was trying to search in internet I couldn't find it.. could you give me the right direction please, thank you

Edited 6 Years Ago by cppgangster: n/a

First try saving that file in Notepad with UTF-8/16/32 encoding, if you can really save them, then Unicode supports you req. char-set & there shouldn't be any problem reading it in binary form & displaying it(requires a font).

I have changed the format of the file, but it doesn't help.
I have tried to simple I/O from keyboard, but It doesn't work.
This is the input and an example:

#include <iostream>
#include <string>
using namespace std;

int main() {
	wstring input;
	cout<<"Please enter the magic word: ";
	wcin>>input;
	wcout<<"Echo: "<<input<<" in English is dude.\n";
	return 0;
}
Please enter the magic word: Bičas
Echo: Bi in English is dude.

First try saving that file in Notepad with UTF-8/16/32 encoding, if you can really save them, then Unicode supports you req. char-set & there shouldn't be any problem reading it in binary form & displaying it(requires a font).

Edited 6 Years Ago by cppgangster: n/a

What I meant was:
1. Open Notepad
2. Type literals from you charset
3. Save
4. Open & verify if the req. literals are still present or have been changed to their ASCII/Unicode equivalents.

What I meant was:
1. Open Notepad
2. Type literals from you charset
3. Save
4. Open & verify if the req. literals are still present or have been changed to their ASCII/Unicode equivalents.

When I reopen these formats I can see the literals, but when I use them for input in the program, I get an exception throw(), and it says invalid byte sequence in the file, but for UTF-8 I don't get the exception and I still get wrong input(it reads up to the Lithuanian literal). I do not use Notepad, I use Gedit text editor for the Linux..anything I can do about the input?

Edited 6 Years Ago by cppgangster: n/a

Can you try inputting a single unicode value 'č' in a wchar_t(not a wstring) & see if it's displayed properly.

This article has been dead for over six months. Start a new discussion instead.