From mime4j-dev-return-1160-apmail-james-mime4j-dev-archive=james.apache.org@james.apache.org Sun Dec 26 23:41:17 2010 Return-Path: Delivered-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Received: (qmail 82148 invoked from network); 26 Dec 2010 23:41:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Dec 2010 23:41:17 -0000 Received: (qmail 4361 invoked by uid 500); 26 Dec 2010 23:41:17 -0000 Delivered-To: apmail-james-mime4j-dev-archive@james.apache.org Received: (qmail 4325 invoked by uid 500); 26 Dec 2010 23:41:17 -0000 Mailing-List: contact mime4j-dev-help@james.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mime4j-dev@james.apache.org Delivered-To: mailing list mime4j-dev@james.apache.org Received: (qmail 4317 invoked by uid 99); 26 Dec 2010 23:41:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Dec 2010 23:41:17 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of max.gravitt@gmail.com designates 209.85.218.49 as permitted sender) Received: from [209.85.218.49] (HELO mail-yi0-f49.google.com) (209.85.218.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Dec 2010 23:41:07 +0000 Received: by yib2 with SMTP id 2so1948392yib.22 for ; Sun, 26 Dec 2010 15:40:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type:subject :date:message-id:to:mime-version:x-mailer; bh=IAgsCaM5rhNbzC67o/IfHFnKiIsXgTOQVwKeDPKX5EE=; b=MoTwf1LxygxLGdUAf0Ps2G8hkkG5+O/qXUCsFxy9wwoXcubUgJ3VkmA0Q2JNSIbM1r 4T0tIq09AhwLDgSmkrTsRONmZQcTZ73rtzOhTsTORRioa5e01hiN5FYJWuzXryJKhftr iWlsmcMEU2rC+hWTRGhbb4Ldn9LBFH+aj/y2w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:subject:date:message-id:to:mime-version:x-mailer; b=xoSPx2acZ/rbYxxPp2S6f42H6E04mEsNnBFaj6+GQmoynGm7Jeg3CODBra6uDqrsXq JW4X2dI490XMt5ukQEuONX3IcbOQzS/APb6iQNR0YmeYFOBPQKzjrCDfBKjXbYOoGQO3 8Xglbs2+yA2VlDDZBgdu9sK8LZppQI/isDUKQ= Received: by 10.236.105.129 with SMTP id k1mr3818796yhg.2.1293406846636; Sun, 26 Dec 2010 15:40:46 -0800 (PST) Received: from [192.168.0.196] (cpe-174-097-189-102.nc.res.rr.com [174.97.189.102]) by mx.google.com with ESMTPS id e74sm6215012yhc.5.2010.12.26.15.40.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 26 Dec 2010 15:40:46 -0800 (PST) From: Max Gravitt Content-Type: multipart/alternative; boundary=Apple-Mail-6--580452105 Subject: Issue Decoding PDF Attachments Date: Sun, 26 Dec 2010 18:40:44 -0500 Message-Id: <7BF04F4D-41B8-4E56-87A8-B22FC212855E@gmail.com> To: mime4j-dev@james.apache.org Mime-Version: 1.0 (Apple Message framework v1082) X-Mailer: Apple Mail (2.1082) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-6--580452105 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, I have an application (running on Google App Engine) that strips = attachments from inbound emails and saves them as a byte[] in the JDO = data store. I think I'm running into a decoding issue, but I'm unsure = of the true issue or the resolution. I'm finding that for some files, = it embeds equal signs in places where the original document doesn't have = any equal signs. I've found that MS documents and HTML are rather = tolerant of this behavior, but PDFs tend to get corrupt when this = happens. Also, it doesn't happen with all PDFs and it seems that it = only happens when the attachment is has a transfer encoding of = "quoted-printable". I'm using MimeStreamParser and I extended SimpleContentHandler = (bodyDecoded method). Then, I use IOUtils.toByteArray(InputStream) to = get the bytes that I save. Any idea of what I may be missing? =20 Below is an example of the contents of a PDF from the "more" command. = You can see the equal signs from the second representation of the file. Original file (Good): 1 0 obj << /CreationDate (D:20101203120005) /Producer (SCS2PDF v1.0 (\251 BeppeCosta, 2005)) /Title (PRINT1) >> endobj 2 0 obj << /Type /Catalog /Pages 3 0 R >> endobj File Snippet After Parsing, Saving, and Retrieving (Bad): 1 0 obj << /CreationDate =3D (D:20101203120005) /Producer (SCS2PDF v1.0 (\251 BeppeCosta, =3D 2005)) /Title (PRINT1) >> endobj 2 0 obj << /Type =3D /Catalog /Pages 3 0 R >> endobj Any thoughts? thanks! MG --Apple-Mail-6--580452105--