Issue
https://github.com/essiembre/eclipse-rbe/issues/83
eclipse-rbe
In Eclipse exist file: messagesBundle_ru_RU.properties
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Created by JInto - www.guh-software.de
#Sun Nov 18 17:19:12 EET 2012
ABS = \u0410\u0411\u0421
About = \u041E \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0435
Add = \u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u043F\u0438\u0441\u0438
Add_Condition = \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0443\u0441\u043B\u043E\u0432\u0438\u0435
Additional = \u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E
How I can convert this to READABLE text in UTF-8 format?
Solution
This is a properties file, and when it was saved to an OutputStream
, any character outside of the ISO-8859-1 character set was replaced with a Unicode escape. The Properties.load(InputStream)
method will decode this for you. You can then save the properties to a new file, specifying UTF-8 encoding.
static void transcodeProperties(Path src, Path dst) throws IOException {
Properties properties = new Properties();
try (InputStream fis = Files.newInputStream(src);
BufferedInputStream is = new BufferedInputStream(fis)) {
properties.load(is);
}
try (Writer w = Files.newBufferedWriter(dst, StandardCharsets.UTF_8, StandardOpenOption.CREATE_NEW)) {
properties.store(w, null);
}
}
Answered By - erickson
Answer Checked By - Katrina (JavaFixing Volunteer)