There is a block of code that reads a line from a file and the line will be in Russian, but accordingly in the terminal instead of Russian letters there are question marks, and in English it is normal to output, as I understand the problem with encodings, how can you solve this problem?
public static void HabitFileReader() { try { FileReader fReader = new FileReader("C:/ProgramData/Tracker Habits/Habit List.txt"); Scanner fScanner = new Scanner(fReader); while (fScanner.hasNext()) { Habit1 = fScanner.nextLine(); System.out.println("Line 1 - " + Habit1); fReader.close(); } } catch (IOException e) { System.out.println("\nFile read error"); } } Write code block:
public static void FileWriter() { try { FileWriter fWriter = new FileWriter("C:/ProgramData/KateProgram/date.txt"); fWriter.write(General.Writer); System.out.println("File successfully write"); fWriter.close(); System.out.println("Program complete"); }catch (IOException e) { System.out.println("File write error"); } }