Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read and write po files using utf 8 encoding #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.gpl.rpg.atcontentstudio.model.tools.i18n;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
Expand All @@ -17,7 +20,7 @@ public class PoPotWriter {

public static void writePoFile(Map<String, List<String>> stringsResources, Map<String, String> translations, File destination) {
try {
FileWriter fw = new FileWriter(destination);
Writer fw = new OutputStreamWriter(new FileOutputStream(destination), StandardCharsets.UTF_8);
if (translations.get("") != null) {
fw.write(translations.get(""));
writeEndOfEntry(fw);
Expand Down
6 changes: 3 additions & 3 deletions src/net/launchpad/tobal/poparser/POParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Vector;

public class POParser
Expand Down Expand Up @@ -60,11 +62,9 @@ private POFile parse(File file)
POFile result = null;
try
{
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
BufferedReader br = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8);
result = parse(br);
br.close();
fr.close();
}
catch (java.io.FileNotFoundException e)
{
Expand Down