|
| ||||||||||
| Tags: configuration file, java, nin file, porgramming language, properties |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Properties of .ini file
I have a little problem with a file "preference.ini" in my application, which contains a line in a euro format. The only problem is the euro sign. That is I have a problem in the properties of .ini file. Here is my code. Code: String str = "preference.ini"; Properties pro = new Properties(); FileInputStream prefDef = new FileInputStream(new File(str)); pro.load(prefDef); prefDef.close(); Last edited by Logan 2 : 25-01-2010 at 12:45 PM. |
|
#2
| ||||
| ||||
| 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. |
|
#3
| |||
| |||
| 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();
} |
|
#4
| |||
| |||
| 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. |
|
#5
| ||||
| ||||
| Re: Properties of .ini file
Hello, Quote:
Quote:
__________________ The FIFA Manager 2009 PC Game |
|
#6
| |||
| |||
| 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(); |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Properties of .ini file" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Eclipse and File Properties | Ash maker | Software Development | 5 | 08-03-2010 08:39 AM |
| Properties file in java | HardWeaR | Software Development | 5 | 23-02-2010 12:54 AM |
| Reading properties of a file | TechGate | Software Development | 5 | 14-02-2010 04:46 AM |
| Change properties of PDF/A file | !const | Windows Software | 3 | 04-05-2009 02:32 PM |
| C#.net how to access properties of a file? | Henrietta | Software Development | 1 | 11-08-2008 01:47 PM |