I'm trying to save a .ini-File with all my tab Data from my tabbedPane, I already managed to do so. But since those Tabs could include UTF-8 characters, I want the File to be saved as UTF-8 without BOM.
While I have no problems reading the UTF-8 .ini-File:
InputStreamReader reader = null;
reader = new InputStreamReader(
new FileInputStream(file), "UTF-8");
ini.load(reader);
As soon as I want to save the edited data it saves it as ANSI and converts the non-ANSI Characters in \uXXXX (X = number):
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
ini.store(writer);
Although it is not really bad for reading, since it's shown correctly in my TabbedPane. It's bad for manually editing, so I'd like to save my file as UTF8 without BOM without these escaped \uXXXX characters.
So what am I doing wrong?
The Ini
class has a method setConfig
that can be used to customize the behavior.
In particular, a Config
that has the escape
property set to false will suppress the escaping of non-ascii characters.