// Methods for producing files
public boolean produce(String template, String filename, TemplateModelRoot model, PrintWriter htmlout) {
- return _produce(template, filename, model, htmlout, false);
+ return _produce(template, filename, model, htmlout, false,
+ MirConfig.getProp("Mir.DefaultEncoding"));
+ }
+
+ public boolean produce(String template, String filename, TemplateModelRoot model, PrintWriter htmlout, String encoding) {
+ return _produce(template, filename, model, htmlout, false, encoding);
}
public boolean produce_compressed(String template, String filename, TemplateModelRoot model, PrintWriter htmlout) {
- return _produce(template, filename, model, htmlout, true);
+ return _produce(template, filename, model, htmlout, true,
+ MirConfig.getProp("Mir.DefaultEncoding"));
}
- private boolean _produce(String template, String filename, TemplateModelRoot model, PrintWriter htmlout, boolean compressed) {
+ private boolean _produce(String template, String filename, TemplateModelRoot model, PrintWriter htmlout, boolean compressed, String encoding) {
try {
File f = new File(producerStorageRoot + filename);
File dir = new File(f.getParent());
// it's important that we set the desired encoding. It should be UTF8
// not the platform default.
OutputStreamWriter outputFileStream =
- new OutputStreamWriter(new FileOutputStream(f),
- MirConfig.getProp("Mir.DefaultEncoding"));
+ new OutputStreamWriter(new FileOutputStream(f), encoding);
PrintWriter outStream;
if (compressed==true) {
outStream = new LineFilterWriter(outputFileStream);
startPageModel.put("dc_now", new SimpleScalar(StringUtil.date2w3DateTime(new GregorianCalendar())));
- /** @todo switch to compressed */
+ /* @todo switch to compressed */
produce(startPageTemplate, producerDocRoot + "/index.shtml", startPageModel, htmlout);
- /** should be mandatory in light of new www.indy newswire */
- produce(featuresRSSTemplate, producerDocRoot + "/features.1-0.rdf", startPageModel, htmlout);
+ /* should be mandatory in light of new www.indy newswire.
+ * but remember Mir is not indy specific. -mh.
+ * Also should it really always be produced in UTF8 chars -mh?
+ */
+ produce(featuresRSSTemplate, producerDocRoot + "/features.1-0.rdf", startPageModel, htmlout, "UTF8");
// finished
logHTMLFinish(htmlout, "Startpage", 1, startTime, System.currentTimeMillis());