When I enter in Eclipse Resource-Bundle editor the german word Löschen (engl. "delete"), it will be automatically converted to "L\u00F6schen". It's correct and fine. But when I search for this word using the Eclipse file search (or quick search), I find something only when I enter "L\u00F6schen", but search for "Löschen" gets no results. Has Eclipse a possibility for UTF-8 search in resource bundles, so I can also find my word/sentence without manual substitutions?
Asked
Active
Viewed 42 times
0
-
You can safely ignore Eclipse’s “assistance” and make ResourceBundle properties a UTF-8 file. From [the docs](https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/util/PropertyResourceBundle.html): “Constructing a PropertyResourceBundle instance from an InputStream requires that the input stream be encoded in UTF-8. By default, if a MalformedInputException or an UnmappableCharacterException occurs on reading the input stream, then the PropertyResourceBundle instance resets to the state before the exception, re-reads the input stream in ISO-8859-1, and continues reading.” – VGR May 13 '19 at 14:21
-
@VGR Since Java 9 properties files can also be encoded in UTF-8, but up to Java 8 it must be encoded in ISO-8859-1. – howlger May 13 '19 at 15:04
-
@howlger I thought so too, but I couldn’t find documentation stating it. – VGR May 13 '19 at 15:15
-
@VGR See Javadoc of Java 8 vs. of Java 9. Not escaping unicode characters does not work in Java 8 or lower. In contrast, escaping unicode characters works in all Java versions and is independent of the encoding. – howlger May 13 '19 at 15:36
-
@howlger Which javadoc? I don’t see it in java.util.Properties. – VGR May 13 '19 at 15:42
-
@VGR See the Javadoc of the same class you quoted: https://docs.oracle.com/javase/8/docs/api/java/util/PropertyResourceBundle.html – howlger May 13 '19 at 15:47
-
1As far as I know, this is not possible. As a workaround you can use a regular expression, e.g. `\bL.{1,6}schen\b` which will find `Löschen`, `L\u00f6schen` and `Löschen` (HTML). – howlger May 13 '19 at 15:50
-
@howlger Thanks for idea. Sorry that the eclipse foundation didn't implement this feature. – Sergiy Medvynskyy May 14 '19 at 06:13
-
@SergiyMedvynskyy The Eclipse foundation provides only the infrastructure for hundreds of open source projects but does not have employed Eclipse IDE developers (like Apache, but in contrast to Mozilla). If you want to have this feature, report it as feature request. In addition, as a Java developer you should be able to write a plug-in for that yourself. – howlger May 14 '19 at 06:34
1 Answers
0
If you have the words stored with the unicode value, instead of the proper umlaut, it means that you don't have the encoding of the file in UTF-8.
At the beginning of the XML you should have something as:
<?xml version="1.0" encoding="XXXX"?>
Just be sure that XXXX is UTF-8 instead of Windows-1252 or ISO-8859-1 and you should be able to save the file with the umlauts and, of course, to search words containing them.
Also, go to your preferences in Eclipse and set the Text File Encoding to UTF-8 (by default is set in Cp1252).

Daniel Campos Olivares
- 2,262
- 1
- 10
- 17
-
It’s more likely that the ResourceBundle data is stored in a properties file than an XML file. – VGR May 13 '19 at 14:20
-
@VGR yeah, you are right. I mean resource bundles and the corresponded editor in Eclipse. – Sergiy Medvynskyy May 13 '19 at 14:21
-
In that case, I think that the best thing that he could do is to change the encoding of files to UTF-8 and create his own ResourceBundle.Control as explained in: https://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle – Daniel Campos Olivares May 13 '19 at 14:22