I'm trying to make BufferedWriter write into txt file in format "latin - cyrillyc",and cyrillyc part is not working(hieroglyphs instead of text),neither do special symbols like ą ł ó ę etc.
FileWriter:
Scanner sc = new Scanner(System.in, StandardCharsets.UTF_8);
FileWriter file = new FileWriter("C:\\Users\\ouzhi\\OneDrive\\Документы\\cardsLibrary\\input.txt",true);
BufferedWriter writer = new BufferedWriter(file);
while (true) {
System.out.print("Import a line to write: ");
String userInput = sc.nextLine().toLowerCase();
if(userInput.equals("stop")){
break;
}
String[] words = userInput.split(" ");
if(words.length >= 3 || words.length == 1){
System.out.println("Please,enter two words");
continue;
}
else{
writer.write(userInput);
writer.newLine();
writer.flush();
}
BufferedReader:
try {
BufferedReader reader = new BufferedReader(new InputStreamReader
(new FileInputStream("C:\\Users\\ouzhi\\OneDrive\\Документы\\cardsLibrary\\input.txt"), StandardCharsets.UTF_8));
Solved by adding "Cp866" to scanner
Scanner sc = new Scanner(System.in,"Cp866")