issues@javamail.java.net

[Bug 4065] New: Wrong representation of CR/LF are appended to the attachment

From: <bugzilla-daemon_at_kenai.com>
Date: Tue, 15 Feb 2011 18:23:55 +0000 (GMT)

http://kenai.com/bugzilla/show_bug.cgi?id=4065

           Summary: Wrong representation of CR/LF are appended to the
                    attachment
           Product: javamail
           Version: 1.4.4
          Platform: All
               URL: http://forums.oracle.com/forums/thread.jspa?threadID=2
                    165347&tstart=0
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P5
         Component: generic
        AssignedTo: shannon_at_kenai.com
        ReportedBy: xray2008_at_kenai.com
                CC: issues_at_javamail.kenai.com


When sending an attachment that's encoded in UTF16-BE (big endian/little
endian/unicode), the line feeds in the attachment appeared to be broken.

Steps to reproduce
1) Use the demo program, modify 'sendfile.java' with the following diff
2) Use the attached text file (encoded in utf16-be) as the attachment, and send
it through.

{code}
diff -r 1e32fa90f44b demo/src/main/java/sendfile.java
--- a/demo/src/main/java/sendfile.java Mon Jan 24 16:28:06 2011 -0800
+++ b/demo/src/main/java/sendfile.java Fri Jan 28 16:55:51 2011 -0800
@@ -90,21 +90,21 @@
         MimeBodyPart mbp2 = new MimeBodyPart();

         // attach the file to the message
+ if (false)
         mbp2.attachFile(filename);

         /*
          * Use the following approach instead of the above line if
          * you want to control the MIME type of the attached file.
          * Normally you should never need to do this.
- *
+ */
         FileDataSource fds = new FileDataSource(filename) {
         public String getContentType() {
- return "application/octet-stream";
+ return "text/plain; charset=utf-16be";
         }
         };
         mbp2.setDataHandler(new DataHandler(fds));
         mbp2.setFileName(fds.getName());
- */

         // create the Multipart and add its parts to it
         Multipart mp = new MimeMultipart();
{code}

-- 
Configure bugmail: http://kenai.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.