This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 256146 - File encoding UTF8 is not used when reloading project
Summary: File encoding UTF8 is not used when reloading project
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milutin Kristofic
Depends on:
Reported: 2015-10-24 08:58 UTC by dqueffeulou
Modified: 2015-10-26 08:43 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

snapshot of the editor lines with wrong encoding (55.99 KB, image/jpeg)
2015-10-24 08:58 UTC, dqueffeulou
File not modified just loaded has wrong encoding (65.61 KB, image/jpeg)
2015-10-24 15:37 UTC, dqueffeulou

Note You need to log in before you can comment on or make changes to this bug.
Description dqueffeulou 2015-10-24 08:58:51 UTC
Created attachment 156945 [details]
snapshot of the editor lines with wrong encoding

I have a project maven Java with UTF-8 selected as file encoding is project properties.
When I edit a java file, all is fine, encoding is right.
Then when I exit Netbeans and restart it, the file I was editing has the wrong encoding. The lines with the wrong encoding are marked "modified" by GIT.
An example of what I got:

TableColumn<BankRowEntry,String> oLibelleCol = new TableColumn<>("Libellé");

It should be "Libellé" (I hope this form supports french characters).

So I have to rollback all these changes before commit or I would commit the wrong encoding strings.
Comment 1 dqueffeulou 2015-10-24 15:36:33 UTC
Even if the file is not in modified state, when I restart netbeans, the file shows GIT differences everywhere a character has been loaded with the wrong encoding.
The second snapshot shows that.
Maybe it's only the file that has focus on start which is not loaded properly.
Comment 2 dqueffeulou 2015-10-24 15:37:31 UTC
Created attachment 156948 [details]
File not modified just loaded has wrong encoding
Comment 3 Vladimir Voskresensky 2015-10-26 08:42:57 UTC
I think you are right. It is the case for the file loaded the first after IDE restart. File's encoding is set up in the Project properties. But when file in editor is opened before project meta-data are loaded, then the default one is used from system. 
Several workarounds:
- leave Welcome page, so it would be the first opened instead of your file
- change default encoding if you work with UTF-8 files only
-- the current default you can find in Help->About: System
-- change your $nbdir/etc/netbeans.conf and add -J-Dfile.encoding=UTF-8 to to netbeans_default_options=...