jon         01/03/18 14:42:51

  Modified:    src/java/org/apache/velocity/anakia AnakiaTask.java
                        OutputWrapper.java
  Log:
  corrected the encoding problem the "right" way. this backs out
  sam's patch. i have tested this now and it seems to work just dandy.
  
  thanks to
  Robert Burrell Donkin <[EMAIL PROTECTED]>
  
  for pointing out the fix.
  
  Revision  Changes    Path
  1.26      +8 -4      
jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java
  
  Index: AnakiaTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AnakiaTask.java   2001/03/15 07:08:34     1.25
  +++ AnakiaTask.java   2001/03/18 22:42:50     1.26
  @@ -56,7 +56,8 @@
   
   import java.io.BufferedWriter;
   import java.io.File;
  -import java.io.FileWriter;
  +import java.io.FileOutputStream;
  +import java.io.OutputStreamWriter;
   import java.io.Writer;
   
   import java.util.StringTokenizer;
  @@ -92,7 +93,7 @@
    * <a href="http://jakarta.apache.org/velocity/anakia.html">Website</a>.
    *   
    * @author <a href="[EMAIL PROTECTED]">Jon S. Stevens</a>
  - * @version $Id: AnakiaTask.java,v 1.25 2001/03/15 07:08:34 jon Exp $
  + * @version $Id: AnakiaTask.java,v 1.26 2001/03/18 22:42:50 jon Exp $
    */
   public class AnakiaTask extends MatchingTask
   {
  @@ -362,7 +363,8 @@
                    *  get the property TEMPLATE_ENCODING
                    *  we know it's a string...
                    */
  -                String encoding = (String) Velocity.getProperty( 
Runtime.TEMPLATE_ENCODING );
  +                String encoding = (String) Velocity
  +                    .getProperty( Runtime.TEMPLATE_ENCODING );
                   if (encoding == null || encoding.length() == 0 
                       || encoding.equals("8859-1") || encoding.equals("8859_1"))
                   {
  @@ -386,7 +388,9 @@
   
                   // Process the VSL template with the context and write out
                   // the result as the outFile.
  -                writer = new BufferedWriter(new FileWriter(outFile));
  +                writer = new BufferedWriter(new OutputStreamWriter(
  +                                            new FileOutputStream(outFile),
  +                                                encoding));
                   // get the template to process
                   Template template = Runtime.getTemplate(style);
                   template.merge(context, writer);
  
  
  
  1.4       +1 -11     
jakarta-velocity/src/java/org/apache/velocity/anakia/OutputWrapper.java
  
  Index: OutputWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/anakia/OutputWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OutputWrapper.java        2001/03/15 11:14:46     1.3
  +++ OutputWrapper.java        2001/03/18 22:42:51     1.4
  @@ -67,7 +67,7 @@
    *
    * @author <a href="[EMAIL PROTECTED]">Jon S. Stevens</a>
    * @author <a href="[EMAIL PROTECTED]">Sam Ruby</a>
  - * @version $Id: OutputWrapper.java,v 1.3 2001/03/15 11:14:46 geirm Exp $
  + * @version $Id: OutputWrapper.java,v 1.4 2001/03/18 22:42:51 jon Exp $
    */
   public class OutputWrapper extends XMLOutputter
   {
  @@ -104,14 +104,4 @@
           }
           return buff.toString();
       }
  -
  -    /**
  -     * Passthru CDATA content uninterpreted
  -     */
  -    protected void printCDATASection(CDATA cdata, java.io.Writer out,
  -                                     int indentLevel) throws IOException
  -    {
  -        out.write(cdata.getText());
  -    }
  -
   }
  
  
  

Reply via email to