diff --git a/src/main/java/de/marhali/easyi18n/io/implementation/JsonTranslatorIO.java b/src/main/java/de/marhali/easyi18n/io/implementation/JsonTranslatorIO.java index 6282502..75b14d6 100644 --- a/src/main/java/de/marhali/easyi18n/io/implementation/JsonTranslatorIO.java +++ b/src/main/java/de/marhali/easyi18n/io/implementation/JsonTranslatorIO.java @@ -44,7 +44,7 @@ public class JsonTranslatorIO implements TranslatorIO { try { for(VirtualFile file : files) { locales.add(file.getNameWithoutExtension()); - JsonObject tree = JsonParser.parseReader(new InputStreamReader(file.getInputStream())).getAsJsonObject(); + JsonObject tree = JsonParser.parseReader(new InputStreamReader(file.getInputStream(), file.getCharset())).getAsJsonObject(); readTree(file.getNameWithoutExtension(), tree, nodes); } @@ -71,7 +71,7 @@ public class JsonTranslatorIO implements TranslatorIO { String fullPath = directoryPath + "/" + locale + "." + FILE_EXTENSION; VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(fullPath)); - file.setBinaryContent(gson.toJson(content).getBytes()); + file.setBinaryContent(gson.toJson(content).getBytes(file.getCharset())); } // Successfully saved @@ -133,8 +133,6 @@ public class JsonTranslatorIO implements TranslatorIO { Map messages = leafNode.getValue(); messages.put(locale, entry.getValue().getAsString()); leafNode.setValue(messages); - - System.out.println("updated key + " + key + "de locale: " + messages.get("locale-de")); } } } diff --git a/src/main/java/de/marhali/easyi18n/io/implementation/PropertiesTranslatorIO.java b/src/main/java/de/marhali/easyi18n/io/implementation/PropertiesTranslatorIO.java index 5feeafe..41161df 100644 --- a/src/main/java/de/marhali/easyi18n/io/implementation/PropertiesTranslatorIO.java +++ b/src/main/java/de/marhali/easyi18n/io/implementation/PropertiesTranslatorIO.java @@ -46,7 +46,7 @@ public class PropertiesTranslatorIO implements TranslatorIO { for (VirtualFile file : files) { locales.add(file.getNameWithoutExtension()); Properties properties = new Properties(); - properties.load(new InputStreamReader(file.getInputStream()));; + properties.load(new InputStreamReader(file.getInputStream(), file.getCharset()));; readProperties(file.getNameWithoutExtension(), properties, nodes); } @@ -72,7 +72,7 @@ public class PropertiesTranslatorIO implements TranslatorIO { ByteArrayOutputStream content = new ByteArrayOutputStream(); properties.store(content, "I18n " + locale + " keys"); - file.setBinaryContent(content.toByteArray()); + file.setBinaryContent(content.toString().getBytes(file.getCharset())); } // Successfully saved