Permalink
Browse files

using a utf-8 writer when calling writeAIML and writeAIMLIF

  • Loading branch information...
kwatters committed Jan 14, 2017
1 parent f552cc6 commit 25f9ea3b3dbe49cd13d7b9d74a3e5270c81a8a3c
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/org/alicebot/ab/Bot.java
@@ -22,6 +22,7 @@
import org.alicebot.ab.utils.IOUtils;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
@@ -416,9 +417,9 @@ public void writeAIMLIFFiles () {
String fileName = c.getFilename();
if (fileMap.containsKey(fileName)) bw = fileMap.get(fileName);
else {
bw = new BufferedWriter(new FileWriter(aimlif_path+"/"+fileName+MagicStrings.aimlif_file_suffix));
String fn = aimlif_path+"/"+fileName+MagicStrings.aimlif_file_suffix;
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fn), StandardCharsets.UTF_8));
fileMap.put(fileName, bw);
}
bw.write(Category.categoryToIF(c));
bw.newLine();
@@ -437,9 +438,7 @@ public void writeAIMLIFFiles () {
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
File dir = new File(aimlif_path);
dir.setLastModified(new Date().getTime());
@@ -467,7 +466,7 @@ public void writeAIMLFiles () {
if (fileMap.containsKey(fileName)) bw = fileMap.get(fileName);
else {
String copyright = Utilities.getCopyright(this, fileName);
bw = new BufferedWriter(new FileWriter(aiml_path+"/"+fileName));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8));
fileMap.put(fileName, bw);
bw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" +
"<aiml>\n");

0 comments on commit 25f9ea3

Please sign in to comment.