added encoding paramater to Producer.produce(). use it for featuresRSS so it can...
authormh <mh>
Fri, 21 Jun 2002 23:41:00 +0000 (23:41 +0000)
committermh <mh>
Fri, 21 Jun 2002 23:41:00 +0000 (23:41 +0000)
source/mircoders/producer/Producer.java
source/mircoders/producer/ProducerStartPage.java

index 28e42da..c415f4a 100755 (executable)
@@ -62,14 +62,20 @@ abstract public class Producer {
 // 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());
@@ -77,8 +83,7 @@ abstract public class Producer {
                        // 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);
index 865c100..774f62e 100755 (executable)
@@ -50,11 +50,14 @@ public class ProducerStartPage extends Producer {
     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());