Re: Properties of .ini file
Hello,
This is normal method load (InputStream) uses the ISO encoding, which does not have the euro character. You have am using the unicode character EURO, or use a InputStreamReader () specifying the encoding of your file. Note that you can also use direct FileReader () who will use the default encoding system.
Otherwise a few remarks:
1) No accents in the names of variables
2) You must use a try / finally to close the stream
Hope the information helps you.
Re: Properties of .ini file
Hello,
Check this code, it may help you and i agree with the above said.
Code:
String str = "preference.ini";
Properties prefDefaut = new Properties();
FileReader prefDef = new FileReader(new File(str));
try {
prefDefaut.load(prefDef);
} finally {
prefDef.close();
}
If you have any more queries with this topic then do post back.
Re: Properties of .ini file
Hi,
In fact, I just simplified my code to put only the commands used. My file is in UTF-8 (as the whole project). In the meantime, I replaced "formatEuros = #. # # €" by "formatEuros = #. # # \ U20AC, but I do not think it will work, though I do not have any idea about it, because I have never implemented it. I'll try with FileReader (), and will see if the program works well.
Re: Properties of .ini file
Hello,
Quote:
My file is in UTF-8 (as the whole project).
In this case it should be read in UTF-8, which does not load (InputStream). have a look at the following statements.
Quote:
Reader prefDef = new InputStreamReader(new InputStream(sys), "UTF-8");
Try the following method and then see if your code runs.
Re: Properties of .ini file
Hey
I have replaced my code with the following part of the program.
Code:
String str = "preference.ini";
Properties pro = new Properties();
File f = new File(str);
InputStreamReader prefDef = new InputStreamReader(new FileInputStream(f),"UTF-8");
pro.load(prefDef);
prefDef.close();