Eclipse .properties file disable escaping of UTF-8 characters - eclipse

I'm using *.properties files in my java/android applications for my translations files. My problem is that .properties files in eclipse escape utf-8 characters that are out of the ISO-8859-1 charset so I see the escaped characters. So I decided to make my own library that reads the file in utf-8 format. BUT eclipse still escapes characters. Is there any way to make eclipse handle *.properties files as normal text files??

Right Click on the file, properties. Under "resource" tab , check for "Text File Encoding" at the bottom right and change that to UTF-8.

Don't call them .properties files, give them another file extension and they will be handled by the text editor only, instead of the properties file editor.
Even without the editing issue you should not call them .properties, as they are not compliant to the Java properties file standard, which might confuse other developers on that project, other tools and so on.
The best solution however is yet another one: Throw away your selfmade implementation and get yourself a better editor for properties files, which shows you the characters as you want to read them, independent of how they are encoded in the file.

Related

bin file in eclipse or notepad

Whenever I tried to open the .bin file in Windows, (and also eclipse), it is like this, so I cannot read anything. I am using it to test Buffer Pool, but I cannot read, so I cannot know that is the test was successful or not. It is same when I opened it wil notepad.
I am using U.S. window, but installed Korean language, but I still can read/write English well.
Extension of file name ".bin" stands for "BINARY". That means your file may contain not-printable characters as you saw.
If you want to see the contenst of binary files, you should use 'Hexadecimal Editor', 'hex editor' in short, instead of text editor like notepad.
http://en.wikipedia.org/wiki/Comparison_of_hex_editors shows many hex editors.
Some software may be able to handle your .bin files. It depends that the origin of that file.

Eclipse and netbeans for properties file in a project

I'm wondering if anyone has encountered this problem and how he solved it. I worked in a project where the IDE is not imposed to developpers (we can use Eclipse, Netbeans etc.).
When working with properties file (Java wait for an ISO-8859-1 encoding), eclipse handles them well, but in Netbeans, each national char (éàü etc.) are automatically escaped like this \uxxx. So eclipse users will get properties file with escaped characters, which is really annoying.
It is painful for i18n for instance.
Does anyone found a workaround for this ?
Edit
In Netbeans 8, it's possible to check an option for properties file that allow us to use project encoding. (See comments below).
That's a sane default behavior - properties file are read using ISO-8859-1 encoding by default (How to use UTF-8 in resource properties with ResourceBundle or find some other resources). I think that NetBeans editor lets you edit them using UTF-8 and converts the content on save. You can override this: select the file (for example in project tab), choose Properties from its context menu and make it use project encoding. NetBeans will not perform the conversion then.

Cannot typing utf-8 in Eclipse Juno

I'm using Eclipse Juno to write Android applications. I have a strange problem:
If I types text (UTF8 characters) in other text editor (.e.g Notepad) and then copy/paste into Eclipse, the characters display correctly, but if typing directly in Eclipse, the characters seem to be converted to ANSI.
I have set text file encoding for project to UTF8 but nothing change.
Right click on file > Properties, the Eclipse shows the file encoding is in UTF8, but if i open file in Notepad++ and check Encoding menu, Notepad++ shows that file is in ANSI.
What is the problem here? please help!
This is exactly why you store all text in strings.xml files on android. They are encoded UTF-8 by default.
Encoding is not property of file, It is about how to treat this file. So changing ecnoding not actually changes anythings. It's Okay.
I think you edited "*.properties" file. In this case, You can't use "UTF-8" because It support only ISO-8859-1, since this file will be load in runtime dynamically.

Eclipse turns Japanese into garbage during refactoring

I have several Java files that have Japanese strings in them, and are encoded in UTF-8. I use Eclipse. However, whenever Eclipse touches them in any automated way, it turns the Japanese into garbage. A good example of this is JAWJAW, the Java Japanese WordNet interface. You can see the code on the website with Japanese characters in it. If you load the project into Eclipse, though, everything will fail because the characters are garbled (bakemoji).
Does anyone know how to fix this?
What is the default encoding for your project?
Future version of Eclipse (like e4) could be set by default to UTF-8, which would avoid any automatic conversion into "garbage".
See bug 108668 for more on that reflexion:
No solution will be perfect. However in the long term I think the current platform specific approach is clearly inferior to a platform-independent UTF-8 default.
+1 UTF-8 should be the obvious default character set for all text files, I had
a problem with eclipse when I was using an English Windows XP system and trying
to open a file in eclipse with Chinese characters, as you can imagine the
display is completely messed up and eclipse doesn't tell me what I need to do.
I had to spend time google for answers. I had to put -Dfile.encoding=UTF-8 in
eclipse.ini so that it behaves correctly.
Making UTF-8 the default is not the right solution for the problem you were
having.
+1 for embedding encoding in the character stream wherever we can (like XML, HTTP, some kinds of file systems).
Encoding is meta-info for the data and belongs to the data, not to a separate user-changeable setup.
The primary reason for this cause is - the unicode supported font is missing from the system fonts. So do the following things to get it done.
Download Arial Unicode MS font and put it inside windows->fonts
directory in windows.
Change the default text encoding in eclipse to UTF-8 by navigating to
Window->Preferences->General->Workspace->Text File encoding
->Other->UTF-8
set Arial Unicode MS font to the Text Font attribute by navigating to
Window->Preferences->General->General->Appearance->colors and
Fonts->Basic->Text Font (select it)->Edit

Change text encoding for multiple files at once in Eclipse

I have some UTF-8 HTML templates in my Eclipse project and Eclipse keeps treating them as if they had a different encoding. It says the encoding is "determined from content". I want to force the correct encoding.
I can force it for a single file but setting an encoding for the parent folder won't affect the files in it because instead of the "inherit" option in the property sheet there's the "determined from content" thing in it's place.
Is it possible to set the encoding for all files in a Project at once?
I've just solved this problem (eclipse 3.5.2)
Two steps required:
Change text file encoding on the folder property page(.setting/org.eclipse.core.resources.prefs file has been created in my project)
Change default encoding on *.html file content type on the Preference page General/Content Types
I've only seen "determined from content" for XML files. In that case it's the only correct setting, because XML files have their encoding defined in their header, so forcing anything else would be a grave mistake.
If you still want to do it, you could try to view the file .settings/org.eclipse.core.resources.prefs in your project (that file may or may not exist dependin on wether you've manually set any encoding in the project or not).
This was caused by a development version of Eclipse. In the latest official release (3.5) it is fixed.