File Encoding handling in Eclipse 3.5 - eclipse

I use Eclipse 3.5 on Windows, with PDT and Subclipse plugins, with both legacy projects using ISO-8859-1 encoding (latin-1), and newers ones wich use UTF-8. I configured my workspace to use UTF-8, and I configured old projects to use latin-1. But every time I open an old project, it use UTF-8.
With a workspace using latin-1 by default, I have the same problem with utf-8 projects edited as iso-8859-1.
My encoding choice is written in the file .settings/org.eclipse.core.resources.prefs but seems to be never read.
The only solution for now is to have a latin1 workspace, and an utf8 one. Any better idea?

In the project's properties (right-click on project => Properties => Resource) there is a Text File Encoding section.
Did you configure the encoding here? If not, you have two choices : "Inherited from container" (which should be the workspace default, in your case UTF-8) and "Other" which let you choose a specific encoding (ISO-88591)...
I just tested that on one of my projects, closed it and reopened it and the ISO88591 encoding is still configured.
Note that I'm using a plain Eclipse though, not a PDT project. PDT may handle encoding settings differently, but somehow I doubt that (file encoding being a low level functionality it makes sense that all plugins share this behavior).

Related

open eclipse with encoding of the saved file

I worked my way through the "eclipse encoding" problems in Stackoverflow. None matches my problem.
I work with files that are windows encoded (ISO92xx) AND UTF8. I want eclipse to open my files with the encoding that the file is saved with and not the default encoding that is set.
Until now I tried to swtch the default encoding to the windows ending. this messes up my files that are UTF-8 encoded.
Please dont tell me that i have to switch the encoding everytime, when i open the file. Eclipse is such a mighty tool. there must be some kind of a way.
Eclipse stores file properties, including its character encoding, in project settings. You can have different properties for each file.
It seems that you don't have a project. Just create one, and, if you don't want to move your files into the project folder, create links to the files via New»File»Advanced»Link….

Open Gradle project in IntelliJ IDEA, set encoding

I am working with IntelliJ IDEA 14.1.2 on Windows 7. My projects use Gradle 2.5. Everytime I open a project using File | Open, all my files get set to windows-1252 encoding. Is there a simple way to set the encoding to UTF-8 for all files (modules, projects) in build.gradle file so that IntelliJ will automatically use this setting?
Even when File | Other Settings | Default Settings | Encodings | Project encoding is set to UTF-8, files are still being opened as windows-1252.
It is possible to go to the settings and set the encoding manually for every file (by applying it to the project root), but this is less than ideal, because each developer has to do that after each clean checkout.
I guess you are using IntelliJ IDEA for Windows...
Have you tried the settings ? Files > Settings then Editor > File Encodings and change IDE Encoding and Project Encoding to UTF-8.
It seems that the recent versions of IDEA (in my case 2016.1.4) use utf-8 by default. This of course means that this specific problem has been solved.

Eclipse text editor encoding settings for displaying European characters

I have been searching online for the correct encoder setting for Eclipse's text editor so that I can view special characters such as European ones (e.g. ä, ü, ß, etc.). The files that I am interested in are some SQL script files (*.sql) which I simply edit, but not run from my Eclipse project. My problem is that when I open the files using eclipse editor, those special characters appear as gibrish, but when I use things like sublime or notepad++ they are okay!. I would very much like to avoid that and be able to use eclipse.
I have tried changing the encoding settings using Window>Preferences and etc. settings. My current encoding is set for ISO-8859 (Latin-1) encoding. Does anyone have any experience in this?
You have to know what encoding your *.sql-Files use.
Apparently notepad++ guesses encoding based on the files content, that's why it works in notepad++. You can try to open the file in notepad++, then open the encoding menu and check what encoding the file has. Then go to eclipse and choose the corresponding encoding.
In general I recommend setting the encoding in eclipse to utf-8.
Edit: I tried to reproduce the problem with Eclipse Luna R2 on Windows 7 by creating a UTF-encoded file in my project folder named "test.sql" with a content of "äöü". Then I set the eclipse encoding to ISO-8859-1 and opened the file by right-clicking in Eclipse->Open With->Text Editor. Eclipse correctly displays the "äöü" string.
Could you please provide more information? What Version of Eclipse do you use? What operating system? How do you open the .sql file in eclipse? Double click? drag'n'drop?
Edit2: I could reproduce the problem by changing the project specific encoding settings: Go to Project Properties->Resource and change the Text file encoding to UTF-8. The Project setting overrides the workspace setting.

Why both netbeans and eclipse force JSP and TAG files to be ISO-8859-1 encoding?

Nobody in the whole world, in these many years of java web development, had this issue?
(I hardly think so)
How to deal with that?
I prefer all (really all) of my sources in UTF8
The default for Eclipse is to encode JSP files as ISO-8859-1 (as for the reason why that is the default, I do not know for sure).
You can change the default encoding used when creating a JSP files (and other files) in Eclipse. Open the preferences dialog (Window > Preferences menu item), then search for encoding.
For existing files in a project, open the files in Eclipse and use the Edit > Set Encoding menu item.
For Eclipse, it's because of JavaServer Pages™ Specification Version 2.2, Maintenance Release 2, Appendix D, sections 1.3g and 2.1c.

How to change file encoding in NetBeans?

I want to change encoding of file in NetBeans IDE (ver 6.9.1), let's say from ANSII to UTF-8. How can I do that?
EDIT: I will be more precise. I don't want to change the default encoding in NetBeans. I want to only change encoding of the currently edited file.
Go to etc folder in Netbeans home --> open netbeans.conf file and add
on netbeans_default_options following line:
-J-Dfile.encoding=UTF-8
Restart Netbeans and it should be in UTF-8
To check go to help --> about and check System: Windows Vista version 6.0 running on x86; UTF-8; nl_NL (nb)
In NetBeans model all project files should have the same encoding. The answer is that you can't do that in Netbeans.
If you are working in Netbeans you should consider to convert all files to a single encoding using other tools.
The NetBeans documentation merely states a hierarchy for FileEncodingQuery (FEQ), suggesting that you can set encoding on a per-file basis:
NetBeans wiki article "DevFaqI18nFileEncodingQueryObject": Project Encoding vs. File Encoding - What are the precedence rules used in NetBeans 6.x?
Just for reference, this is the wiki-page regarding project-wide settings:
NetBeans wiki article "FaqI18nProjectEncoding": How do I set or modify the character encoding for a project?
There is an old Bugreport concerning this issue.
Yes, you can change the encoding of a specific file (or see what it has) with this Encoding Support plugin. With this plugin you will be able to handle the different encodings of your files without problems.
Now it is in version 1.4.0 for NetBeans 8.2 and I use it in Windows 10 several time ago.
The operation is very simple, in the status line you can see the encoding of the open file, and from there you can define its new encoding.
On project explorer, right click on the project, Properties -> General -> Encoding. This will allow you to choose the encoding per project.
This link answer your question:
http://wiki.netbeans.org/FaqI18nProjectEncoding
You can change the sources encoding or runtime encoding.
Just try to set the Projects Encoding to "UTF-8" and copy the file (which is encoded in iso) in the same Project (and if you dont need the old file just delete it) - now the copied file will be as UTF-8 - maybe this will help you :)