Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

Commit

Permalink
Experimental: Explicitly save HTML files in the exporter as UTF-8.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianonline committed Sep 20, 2016
1 parent 81ac38f commit 517e5b6
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

import java.io.File;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.nio.charset.Charset;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
Expand Down Expand Up @@ -85,7 +87,7 @@ public void export(UserManager user) {

MustacheFactory mf = new DefaultMustacheFactory();
Mustache mustache = mf.compile("templates/html/index.mustache");
FileWriter w = new FileWriter(base + "index.html");
OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(base + "index.html"), Charset.forName("UTF-8").newEncoder());
mustache.execute(w, scope);
w.close();

Expand All @@ -104,7 +106,7 @@ public void export(UserManager user) {
scope.putAll(db.getMessageTypesWithCount(d));
scope.putAll(db.getMessageMediaTypesWithCount(d));

w = new FileWriter(base + "dialogs" + File.separatorChar + "user_" + d.id + ".html");
w = new OutputStreamWriter(new FileOutputStream(base + "dialogs" + File.separatorChar + "user_" + d.id + ".html"), Charset.forName("UTF-8").newEncoder());
mustache.execute(w, scope);
w.close();
}
Expand All @@ -122,7 +124,7 @@ public void export(UserManager user) {
scope.putAll(db.getMessageTypesWithCount(c));
scope.putAll(db.getMessageMediaTypesWithCount(c));

w = new FileWriter(base + "dialogs" + File.separatorChar + "chat_" + c.id + ".html");
w = new OutputStreamWriter(new FileOutputStream(base + "dialogs" + File.separatorChar + "chat_" + c.id + ".html"), Charset.forName("UTF-8").newEncoder());
mustache.execute(w, scope);
w.close();
}
Expand Down

0 comments on commit 517e5b6

Please sign in to comment.