You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by an...@apache.org on 2003/08/21 17:26:46 UTC

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/email PlainMailer.java

antoine     2003/08/21 08:26:46

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/email
                        PlainMailer.java
  Log:
  Make PlainMailer also work with foreign character sets.
  PR: 15434
  
  Revision  Changes    Path
  1.486     +1 -1      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.485
  retrieving revision 1.486
  diff -u -r1.485 -r1.486
  --- WHATSNEW	19 Aug 2003 12:15:03 -0000	1.485
  +++ WHATSNEW	21 Aug 2003 15:26:46 -0000	1.486
  @@ -389,7 +389,7 @@
   
   * <antlr>'s debug attribute has been enabled.  Bugzilla Report 19051.
   
  -* <mail> has a new attribute encoding. Bugzilla Report 15434.
  +* <mail> has a new attribute charset. Bugzilla Report 15434.
   
   * <mail> has new attributes user and password for SMTP auth.
     maillogger can also use this.
  
  
  
  1.11      +8 -3      ant/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java
  
  Index: PlainMailer.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PlainMailer.java	19 Jul 2003 08:11:03 -0000	1.10
  +++ PlainMailer.java	21 Aug 2003 15:26:46 -0000	1.11
  @@ -107,10 +107,14 @@
               }
   
               mailMessage.setHeader("Date", getDate());
  -            mailMessage.setHeader("Content-Type", message.getMimeType());
  +            if (message.getCharset() != null) {
  +                mailMessage.setHeader("Content-Type", message.getMimeType()
  +                    + "; charset=\"" + message.getCharset() + "\"");
   
  +            } else {
  +                mailMessage.setHeader("Content-Type", message.getMimeType());
  +            }
               PrintStream out = mailMessage.getPrintStream();
  -
               message.print(out);
   
               e = files.elements();
  @@ -156,7 +160,8 @@
           }
   
           int length;
  -        byte[] buf = new byte[1024];
  +        final int maxBuf = 1024;
  +        byte[] buf = new byte[maxBuf];
           FileInputStream finstr = new FileInputStream(file);
   
           try {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org