DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20985>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20985

[PATCH]support charset for SMTPAppender

           Summary: [PATCH]support charset for SMTPAppender
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Appender
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Current SMTPAppender don't support charset. So, we can't use other than US
ISO-8859-1 Character. This patch help to set charset for SMTPAppender and
improve internationalization support.

Here is a patch for 1.2.8. If you are intested in it,  please take it.



--- src/java/org/apache/log4j/net/SMTPAppender.java.orig        2003-06-22 06:22
:16.000000000 +0900
+++ src/java/org/apache/log4j/net/SMTPAppender.java     2003-06-22 06:49:10.0000
00000 +0900
@@ -47,11 +47,12 @@
   private String from;
   private String subject;
   private String smtpHost;
+  private String charset = "ISO-8859-1";
   private int bufferSize = 512;
   private boolean locationInfo = false;
 
   protected CyclicBuffer cb = new CyclicBuffer(bufferSize);
-  protected Message msg;
+  protected MimeMessage msg;

   protected TriggeringEventEvaluator evaluator;
 
@@ -98,7 +99,7 @@
 
        msg.setRecipients(Message.RecipientType.TO, parseAddress(to));
        if(subject != null)
-        msg.setSubject(subject);
+        msg.setSubject(subject, charset);
      } catch(MessagingException e) {
        LogLog.error("Could not activate SMTPAppender options.", e );
      }
@@ -229,7 +230,7 @@
       t = layout.getFooter();
       if(t != null)
        sbuf.append(t);
-      part.setContent(sbuf.toString(), layout.getContentType());
+      part.setContent(sbuf.toString(), layout.getContentType() + ";charset=" + 
charset);
 
       Multipart mp = new MimeMultipart();
       mp.addBodyPart(part);
@@ -375,6 +376,22 @@
   boolean getLocationInfo() {
     return locationInfo;
   }
+
+  /**
+   * Set charset for other than ASCII character.
+   */
+  public
+  void setCharset(String charset) {
+    this.charset = charset;
+  }
+
+  /**
+   * Set charset for other than ASCII character.
+   */
+  public
+  String getCharset() {
+    return charset;
+  }
 }
 
 class DefaultEvaluator implements TriggeringEventEvaluator {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to