Domanda

Sto cercando di utilizzare l'INI4J per ottenere dati da un file di registro del software di Windows.Il file sembra:

[Production]
Code=I-MS01-11002
Time=2012-01-25T15:58:50+02:00
RequestType=Process Order
OrderID=0183
.

Quando provo:

Wini ini = new Wini(fileList[i]);
System.out.println(ini.keySet());
.

L'output è: [?, p r o d u c t i o n]

Si prega di avvisare dove sto sbagliando.

È stato utile?

Soluzione

I have found the original file is saved in UTF16 format. A work around, that seems to work, but may not be the best way to do it:

InputStream is = new BufferedInputStream(new FileInputStream(fileList[i]));
Reader reader = new InputStreamReader(is, "UTF-16");
Ini ini = new Ini();
ini.load(reader);
System.out.println(ini.keySet());

The output is now: [Production]

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top