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

Summary: File encoding UTF8 is not used when reloading project
Product: editor Reporter: dqueffeulou <dqueffeulou>
Component: -- Other --Assignee: Milutin Kristofic <mkristofic>
Status: NEW ---    
Severity: normal CC: vv159170
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: snapshot of the editor lines with wrong encoding
File not modified just loaded has wrong encoding

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=...