Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92B7C103FE for ; Mon, 3 Feb 2014 18:32:27 +0000 (UTC) Received: (qmail 38362 invoked by uid 500); 3 Feb 2014 18:32:24 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 38260 invoked by uid 500); 3 Feb 2014 18:32:24 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 38252 invoked by uid 99); 3 Feb 2014 18:32:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Feb 2014 18:32:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of thomas.neidhart@gmail.com designates 209.85.215.170 as permitted sender) Received: from [209.85.215.170] (HELO mail-ea0-f170.google.com) (209.85.215.170) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Feb 2014 18:32:16 +0000 Received: by mail-ea0-f170.google.com with SMTP id k10so3957479eaj.1 for ; Mon, 03 Feb 2014 10:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=BRJhj6EDEhNo8NBo8YqCVvk87N7X3LxtVRj7ohZJdl0=; b=DBZmol58cOML+xtbpiQyEviKE2jzvEoLERq4iva06PNgPMeDji0NlE9ADaQ1idI7SZ ls3oKJ3wd/aTTFeZvT/9xjscOb23FuC11oW04OYxbQDuOPmStm9salSHOyXV7dOZniHV k3z+Z4gS7FK/morNea6gPCDcpBySlpIxWypscBKFPlKxOCvTxrAG+wp8F8ziDBjNBJpj HjOkbbM9sZm497dt8QzWevt9Qtt1DffH4eHjjOFtbFgIdNuluAPbDUTE+uBX4OUM2sZo 3KN3sm+verIUwefrAgdg//lPOx1ZOIvMEzonnURZ9MnjA587ZDR53Ai7YpXNoCfYj9n3 Mm9Q== X-Received: by 10.15.93.203 with SMTP id w51mr45528479eez.33.1391452316710; Mon, 03 Feb 2014 10:31:56 -0800 (PST) Received: from [192.168.1.2] (ip-81-11-211-95.dsl.scarlet.be. [81.11.211.95]) by mx.google.com with ESMTPSA id 8sm78369401eeq.15.2014.02.03.10.31.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:31:55 -0800 (PST) Message-ID: <52EFE099.3040205@gmail.com> Date: Mon, 03 Feb 2014 19:31:53 +0100 From: Thomas Neidhart User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Commons Users List Subject: Re: [net] decoding quoted-printable? References: <52EFC929.7050900@gmail.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 02/03/2014 07:16 PM, Alex O'Ree wrote: > Thanks for the quick reply. > > I'm running into this now. > > org.apache.commons.codec.DecoderException: Invalid URL encoding: not a > valid digit (radix 16): 117 > > from the following code: > > BufferedReader reader = (BufferedReader) pop3.retrieveMessage(msginfo.number); > String line = ""; > StringBuilder sb = new StringBuilder(); > while ((line = reader.readLine()) != null) { > String lower = line.toLowerCase(Locale.ENGLISH); > sb.append(lower); > } > > String msg=sb.toString(); > byte[] bits; > try { > bits = org.apache.commons.codec.net.QuotedPrintableCodec.decodeQuotedPrintable(msg.getBytes("UTF8")); > msg = new String(bits, "UTF8"); > } catch (Exception ex){//throw from here } > > > Any suggestions? It looks like you are trying to decode the whole message using the QuotedPrintable decoder, which will of course not work, as not the whole message is encoded like that, only the respective attachment. There is yet another commons library, commons-email that helps you with that. So you should parse your message with the MimeMessageParser from there, get the attachment and decode it using the QuotedPrintableCodec. btw. it is probably easier if you use java-mail together with commons-email to do the job instead of using commons-net for this purpose, but that's up to you. Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org