Results 1 to 3 of 3
  1. #1
    mwildam's Avatar
    mwildam is offline Member
    Join Date
    Aug 2007
    Posts
    72
    Rep Power
    0

    Default MimeUtility.decode encoding

    I tried to extract attachments from a mime message and first I got errors like

    "needed at least 2 valid base64 characters ... "

    Searching the internet I found people having similar issues and setting
    Java Code:
    System.setProperty("mail.mime.base64.ignoreerrors", "true");
    solved their problem - but for me didn't.

    Instead looking at samples and playing around I found out that
    Java Code:
    os = MimeUtility.decode(part.getInputStream(), "binary");
    solved my problem where previously I used:
    Java Code:
    enc = MimeUtility.getEncoding(part.getDataHandler());
    os = MimeUtility.decode(part.getInputStream(), enc);
    My question: According to decode method's javadoc I cannot see any logical reason or hint why I have to use "binary" and not the actual encoding of the content. So why the hell do I have to use "binary"? I don't understand that.
    Greetings, Martin Wildam.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,609
    Rep Power
    23

    Default

    Where is the MimeUtility defined? I don't see it in my JDK 1.6

  3. #3
    mwildam's Avatar
    mwildam is offline Member
    Join Date
    Aug 2007
    Posts
    72
    Rep Power
    0

    Default

    It is part of the javamail package.
    Greetings, Martin Wildam.

Similar Threads

  1. encoding special characers in jsp
    By nanimtech in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 05-06-2008, 01:22 PM
  2. Some help with encoding...
    By nm123 in forum Networking
    Replies: 0
    Last Post: 04-15-2008, 12:22 AM
  3. Missing text encoding
    By talgreen in forum Eclipse
    Replies: 0
    Last Post: 03-30-2008, 08:14 PM
  4. Replies: 1
    Last Post: 03-28-2008, 05:08 PM
  5. How to convert the encoding of a file
    By valery in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 03:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •