Thanks for the tip. Problem solved with commons-email!

On Mon, Feb 3, 2014 at 1:31 PM, Thomas Neidhart
<[email protected]> wrote:
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to