Eclipse and Scala-IDE source files encoding bug? - eclipse

I am working on a simple project in Eclipse in Scala-IDE. The project makes use of someone else's library (which comes in *.java source files, not in a .jar). The library source files contain numerous comments in Japaneese. I cannot compile the Scala project since for every such file I get an error like this one:
IO error while decoding
D:\path\FileName.java
with windows-1252 Please try specifying another one using the
-encoding option
Seems like I did not have this problem when the project was in Java. Now I am migrating to Scala and that is what I am getting.. I do not want to delete all these comments, is there any way to make the compiler handle them? I have tried all kinds of encoding fixes starting from Preferences->Resources->Text file encoding and ending with eclipse.ini file encoding parameters...

I had a similar issue after I switched from linux to macosx
Eclipse default text file encoding was set to US-ASCII, to fix this:
(Eclipse Juno)
Open the preferences
General - Workspace
Switch "text file encoding" to "UTF-8"

I have resolved the issue. The Scala compiler has a different set of options that likely does not subdue to the global Eclipse options. So by going to Preferences->Scala->Compiler and adding -Dfile.encoding=UTF-8 to the Additional command line parameters field I have fixed the error.

Related

Using launch4j to build executable with encoding option

I'm trying to write korean to a txt file. I've done the coding part and exported project to runnable jar.
When I run jar file using terminal as Java -Dfile.encoding="UTF-8" -jar Utul.jar it works perfectly fine.
Now I'm trying to make .exe using launch4j can anyone help me set this option? In output file I'm getting gibberish instead of Korean characters.
I've got the answer now. I wasn't aware of the JVM options field under JRE tab. I included this option there and result was satisfactory.

How to get Eclipse CDT to parse .h.in files like .h files?

I'm editing a config.h.in file for my project, and I want syntax highlighting like in .h files. I added *.h.in as a file type of C++ headers using Eclipse' preference dialog, closed the app and restarted it - but the file is still treated like plain text. Is this because of the double-extension? If not, can I do something about it (other than renaming the file of course)?
I'm using Oxygen.3 on GNU/Linux.
As #HighCommander commented, this is indeed the known Eclipse bug 422923.

Net beans opens files in utf 8 even though project is in different encoding

My project is in Windows-1251 encoding. It depends on outside library which is a common dependency for many projects and therefore is stored in diferrent directory on my machine apart from projects. I added path to the library in my project's properties -> include path. The files in this library are also all in windows-1251 encoding. Net beans opens my project files correctly, thanks for that, but when I try to navigate to some method definition in library files (by ctrl+click on it) I get this warning saying the file can't be safely opened with utf-8 encoding. If I choose to open it anyway it opens with totally messed up non-ASCI characters of course. Is it possible to tell NetBeans to open files from include path with encoding used in currently opened project? I couldn't find any encoding-related setting apart from project's encoding. Thanks in advance.
Apparently there's nothing you can do about it. I switched to Eclipse.

How can I get Eclipse to warn me about unmappable characters?

I recently pasted an ellipsis character (…) into comments in my (Mac) Java code in the Eclipse editor; it compiled fine and complained not at all. Unfortunately when I checked the code in, the compiler on the (linux) build server was not happy. How can I configure Eclipse to warn me about such errors? I saw nothing relevant in Preferences > Java > Compiler > Errors/Warnings.
What encoding is the build server expecting the files to be using? It might not be a case of compiler warnings and errors but of setting the encoding that Eclipse is using to save the files.
Update
This one's been bugging me so I ended up searching around for an answer. It would seem that because Eclipse uses its own compiler rather than a stock javac you cannot pass arguments to it. There's a -encoding option or javac which allows you to specify the encoding of the files to be compiled (without it, the platform default is used).
If the build server is running Linux it's likely defaulting to UTF-8. I know nothing about the Mac's default encoding, but it could be something else entirely. It might be worth creating an ant build task in your project which specifies the character encoding and using that to double check before checking in code. It's a manual process, but might save some pain in the long run.

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 :)