I have a problem with .properties
files in Netbeans. I use such files in order to provide some localized strings in my app.
Case 1
If I create a new .properties
file in Netbeans (New -> Properties File
) and I but some lines there:
INFO_OEFFNEN=Открыть информацию
FILE=Файл
SPRACHE=Язык
everything works fine and all strings are translated properly:
But if I open this file by means of Notepad++ I see what follows (Notepad++ recognizes the encoding, maybe incorrectly, as UTF-8
):
INFO_OEFFNEN=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e
FILE=\u0424\u0430\u0439\u043b
SPRACHE=\u042f\u0437\u044b\u043a
Case 2
If I create an UTF-8
encoded .properties
file with Notepad++ containing the following lines:
INFO_OEFFNEN=Открыть информацию
FILE=Файл
SPRACHE=Язык
and open it in Netbeans I see this:
INFO_OEFFNEN=ÐÑкÑÑÑÑ Ð¸Ð½ÑоÑмаÑиÑ
FILE=Файл
SPRACHE=ЯзÑк
In GUI I can see something very strange:
Case 3
I make the same as in case 2 but I in Netbeans I set the "use project encoding
" property of a .properties
file to true
.
Now in Netbeans editor I see correct text (but 100% marked as "modified" by SVN). When I start the App strings looks like this:
Question:
I assume that the default encoding of properties files created by Netbeans is not UTF-8. How can I check which encoding does Netbeans use by default in this case?
I would like to write a short Java app which reads a .properties
file (created by Netbeans), adds or replaces some lines and creates a new file which should be read by Netbeans correctly. Which encoding should I use in InputStreamReader
?
Please give me some tips about this problem. Is my assumption about different default encoding in Netbeans correct? I'm affraid I don't understand some important issue here.
Some addional info:
- Netbeans project encoding: UTF-8
- Help->About:
*NetBeans IDE 8.1 (Build 201510222201)
*Java: 1.8.0_92; Java HotSpot(TM) 64-Bit Server VM 25.92-b14
*System: Windows 7 version 6.1 running on amd64; UTF-8; de_DE (nb)