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 157498 - Per file encoding
Summary: Per file encoding
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Settings (show other bugs)
Version: 8.2
Hardware: All All
: P2 blocker with 13 votes (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
: 190236 228072 255109 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-01-27 13:59 UTC by leszczu
Modified: 2016-12-09 08:50 UTC (History)
7 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description leszczu 2009-01-27 13:59:33 UTC
Netbeans lacks ability to set per file encoding. My projects use two different encodings at the same time, I'm unable to
work with some files.
Comment 1 caesar2k 2009-07-13 22:12:54 UTC
This is really needed! Also, it's no harsh at all to implement such thing.
I get old sites that mix windows, ISO and UTF-8 encodings, and sometimes I need to use Dreamweaver (!!) to change the
characters on the files, to UTF-8 to ISO, or windows to UTF-8
Comment 2 roti 2009-07-31 09:46:35 UTC
You can use the encoding plugin:
http://www.netbeans.org/issues/show_bug.cgi?id=114123
Comment 3 neuros_nid 2009-09-29 16:35:27 UTC
Well, I've tried the plugin, and it doesn't fit at all...

It allows to open or save a file in another charset. That's enough for conversion but...

What would be needed is a system similar to the one of Eclipse :
in the Project view, the properties of a folder should at least allow to select a charset that will be recursively 
considered as overloading the default one.
And that would make the "properties" view of a file/folder useful.

Honestly, as our projects, in their own charset, contain a SVN externalized common core in UTF8, that we're all 
brought to modify from time to time, that's the only thing that restrain a lot of people here from using NetBeans, 
instead of an IDE able to manage multiple charsets.
Comment 4 neuros_nid 2009-09-29 16:35:51 UTC
Well, I've tried the plugin, and it doesn't fit at all...

It allows to open or save a file in another charset. That's enough for conversion but...

What would be needed is a system similar to the one of Eclipse :
in the Project view, the properties of a folder should at least allow to select a charset that will be recursively 
considered as overloading the default one.
And that would make the "properties" view of a file/folder useful.

Honestly, as our projects, in their own charset, contain a SVN externalized common core in UTF8, that we're all 
brought to modify from time to time, that's the only thing that restrain a lot of people here from using NetBeans, 
instead of an IDE able to manage multiple charsets.
Comment 5 neuros_nid 2009-09-29 16:36:26 UTC
Well, I've tried the plugin, and it doesn't fit at all...

It allows to open or save a file in another charset. That's enough for conversion but...

What would be needed is a system similar to the one of Eclipse :
in the Project view, the properties of a folder should at least allow to select a charset that will be recursively 
considered as overloading the default one.
And that would make the "properties" view of a file/folder useful.

Honestly, as our projects, in their own charset, contain a SVN externalized common core in UTF8, that we're all 
brought to modify from time to time, that's the only thing that restrain a lot of people here from using NetBeans, 
instead of an IDE able to manage multiple charsets.
Comment 6 Milutin Kristofic 2013-04-09 14:19:12 UTC
*** Bug 228072 has been marked as a duplicate of this bug. ***
Comment 7 gabimem 2014-02-11 13:40:07 UTC
Is it possible to make this work like notepad++?.

I think it's the best way to manage file encodings, to choose how to read and how to convert, without breaking the file to open, as does the netbeans.
Comment 8 motofix 2014-11-04 15:55:36 UTC
I have a project where properties files are encoded in ISO-8859-1, as required by Java APIs, and JSON files for web content encoded in UTF-8... Being unable to choose an encoding as per folder / file basis is a real pain as I have to switch from Netbeans to another editor to handle this, and merge conflict resolution concerning these files is a real nightmare.

I would say the priority on this enhancement request should be reviewed and increased.
Comment 9 coladict 2015-01-14 08:43:35 UTC
We have a Java web-project that uses UTF-8 encoding everywhere, however removing the '<%@page contentType="text/html; charset=UTF-8" session="true"%>' line from the start of included JSP files causes them to immediately be converted into some other encoding, losing any and all special symbols.

None of the described workarounds I could find solve this. I moved to Netbeans, because Eclipse crashed crashed almost every time I debugged anything. Switching between two IDEs depending on the hourly needs is not a solution.
Comment 10 riksoft 2015-08-04 09:57:21 UTC
It's a huge problem also for me.

I can't port many web projects to Netbeans from Eclipse because this projects use both files UTF-8 encoded and ISO-8859-1 files.

So I'm forced to use Netbeans only for those projects I'm 100% sure there will be only 100% files with the same encoding! :(
Comment 11 azige 2015-08-24 12:42:31 UTC
I was even trapped in a worse siuation. I have a maven java web project including some files out of maven constraint. The charset of the project is setted to UTF-8 and all the files are in UTF-8. But when I open some css and js files, NetBeans just warn me that it can't be opened in GBK(my local charset) and ask me whether to continue or not. Although java files can be correctly opened in UTF-8.

I think it's neccesary to add a feature that allows you to set the default charset in NB editor, not always local charset. Or when it found it's a bad idea to open a file in local charset, just let me choose which charset to use rander than let me click continue button and show me the file in mess.

I tried to write some plugins but never try to modify the IDE itself. Is there any quick reference about the NB editor?
Comment 12 riksoft 2015-08-24 14:01:06 UTC
Until they fix this problem there are 2 workarounds (very workarounds :-) ):
- Open the files with a different charset with another external editor
- Use Eclipse (no problems with projects with mixed charsets)

If Bugzilla allowed me to unload all my votes on a single bug, I would do it on this one because is actually a huge problem. I have to deal with 2 IDEs, will the problems involved (remembering shorcuts and stuff), just, exclusively because of this bug.
Comment 13 riksoft 2015-08-24 14:59:46 UTC
"will the problems involved"...
I meant:
"with all the problems involved"
:-)
Comment 14 Milutin Kristofic 2015-09-09 09:07:20 UTC
*** Bug 190236 has been marked as a duplicate of this bug. ***
Comment 15 Milutin Kristofic 2015-09-09 09:09:44 UTC
*** Bug 255109 has been marked as a duplicate of this bug. ***
Comment 16 mossroy 2015-09-22 12:17:14 UTC
It happens quite often that a Java Maven project also includes other source files (like SQL, .bat/.cmd, CSV etc).
They are in the same project in order to be tagged/released at the same time as Java files, because they must have the same life cycle.

When these files do not have the same encoding as the one specified in Maven, Netbeans is not able to read them correctly
Comment 17 lindsten 2016-12-09 08:48:57 UTC
I'm a strong NB supporter, but it's kind of embarrassing that NB can't handle projects with multiple file encodings. I use NB at work instead of JBoss Dev Studio that everybody else is using because it's just so much better (Eclipse and I don't get along), but having to use another editor to handle certain files with different encoding is really annoying! ... and it makes promoting NB kind of futile =/

I've seen comments to older bug reports on this issue saying that javac requires all Java files to have the same encoding. Still true (I think), but there are lots of other files in our projects, like JS for example!