james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wiederkehr <markus.wiederk...@gmail.com>
Subject Re: DecoderUtil question.
Date Sun, 16 Aug 2009 20:22:31 GMT
On Sun, Aug 16, 2009 at 3:00 PM, Wim Jongman<wim.jongman@gmail.com> wrote:
> Hi,
> I came across this line in a message:
>
> utf  "=?utf-8?Q?Re:=20How=20to=20place=20a=20view=20at=20the=20bottom?=
> =?utf-8?Q?=20with=20a=20100%=20width?="
> System.out.println(DecoderUtil.decodeEncodedWords(utf));
>
> gives:
>
> Re: How to place a view at the bottom =?utf-8?Q?=20with=20a=20100%=20width?=
>
> but should give:
>
> Re: How to place a view at the bottom with a 100% width

Hi Wim,

I think you've found a bug in Mime4j..

DecoderUtil assumes that an encoded word starts with =? and ends with
the first occurrence of ?= following the =?.

In your case it falsely identifies =?utf-8?Q?= as the encoded word and
ignores the remainder (20with=20...). It then fails to decode
=?utf-8?Q?= and returns the string as is..

RFC 2047 section 5 states that <quote>for a "Q" 'encoded-word', any
"=" character that appears in the 'encoded-text' portion will be
followed by two hexadecimal characters.</quote>

Thanks,
Markus


> Is there something i have missed?
>
> Best regards,
>
> Wim

Mime
View raw message