2

I'am using library ini4j for work with ini file's. My problem is, when i make a ini file:

 try (PrintWriter writer = new PrintWriter("path" + ".ini", "UTF-8")) {    
        writer.println("[Main_Menu]");
        writer.println("TEST = Příliš žluťoučký kůň úpěl ďábelské ódy");           
}

I cannot read correctly a String and i have charset problem.

Read:

Ini ini = new Ini();
ini.load(new FileReader(new File("path" + ".ini")));
Ini.Section section = (Section) ini.get("Main_Menu");
System.out.println("\u0020" + section.get("TEST"));

Can you help me? How to read correctly? (in path.ini file is correctly string)

beresfordt
  • 5,088
  • 10
  • 35
  • 43
paetreph
  • 53
  • 1
  • 4

1 Answers1

1

Instead of FileReader you need to use new InputStreamReader(new FileInputStream(...), "UTF-8").

Bram
  • 479
  • 2
  • 10