You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by Michael Kussmaul <ku...@nix.ch> on 2012/02/08 11:21:07 UTC
Attachment-Names with Umlaute?
Hi
I still use mime4j 0.6 because it had the attachment-name in the BodyDescriptor (as part of the callback: public void body(BodyDescriptor desc, InputStream stream) throws MimeException, IOException) which seems to be removed in 0.7? But using the old 0.6 version I encountered, that if the filename has Umlaute or other special characters in it, it does not fully decode the file-name, e.g. an original filename:
"Optimized Dällikon-Bern.gpx"
is being reported as:
=?iso-8859-1?Q?Optimized_D=E4llikon-Bern=2Egpx?=
I was wondering what the "best practices" are to access and decode the filename e.g. in version 0.7.2 of mime4j? Looking at your examples "org.apache.james.mime4j.samples.tree.MessageTree" I only found how to use the DOM API, but is this also possible using your event API?
In any case many thanks for mime4j, it's a great library!
Michael
Re: Attachment-Names with Umlaute?
Posted by Michael Kussmaul <ku...@nix.ch>.
Thanks for the info, I now parse the filename field manually (actually using the java-mail MimeUtility.parseText method) and it now works.
You are also right about the second part: In 0.7 I get a MaximalBodyDescriptor (actually the callback still returns an almost empty BodyDescriptor which is just an interface declaration, but it's actually a MaximalBodyDescriptor ) and it has a similar method to get the filename.
kind regards
Michael
On 09.02.2012, at 14:41, Oleg Kalnichevski wrote:
> On Wed, 2012-02-08 at 11:21 +0100, Michael Kussmaul wrote:
>> Hi
>>
>> I still use mime4j 0.6 because it had the attachment-name in the BodyDescriptor (as part of the callback: public void body(BodyDescriptor desc, InputStream stream) throws MimeException, IOException) which seems to be removed in 0.7?
>
> I am pretty sure it is still there.
>
>> But using the old 0.6 version I encountered, that if the filename has Umlaute or other special characters in it, it does not fully decode the file-name, e.g. an original filename:
>>
>> "Optimized Dällikon-Bern.gpx"
>> is being reported as:
>> =?iso-8859-1?Q?Optimized_D=E4llikon-Bern=2Egpx?=
>>
>> I was wondering what the "best practices" are to access and decode the filename e.g. in version 0.7.2 of mime4j? Looking at your examples "org.apache.james.mime4j.samples.tree.MessageTree" I only found how to use the DOM API, but is this also possible using your event API?
>>
>
> One can certainly parse header fields inside #field(Field rawField)
> method either using field parsers from DOM module or using a custom
> parser of some sort. Personally that is how I use mime4j.
>
> Hope this helps
>
> Oleg
>
>> In any case many thanks for mime4j, it's a great library!
>> Michael
>
>
Re: Attachment-Names with Umlaute?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2012-02-08 at 11:21 +0100, Michael Kussmaul wrote:
> Hi
>
> I still use mime4j 0.6 because it had the attachment-name in the BodyDescriptor (as part of the callback: public void body(BodyDescriptor desc, InputStream stream) throws MimeException, IOException) which seems to be removed in 0.7?
I am pretty sure it is still there.
> But using the old 0.6 version I encountered, that if the filename has Umlaute or other special characters in it, it does not fully decode the file-name, e.g. an original filename:
>
> "Optimized Dällikon-Bern.gpx"
> is being reported as:
> =?iso-8859-1?Q?Optimized_D=E4llikon-Bern=2Egpx?=
>
> I was wondering what the "best practices" are to access and decode the filename e.g. in version 0.7.2 of mime4j? Looking at your examples "org.apache.james.mime4j.samples.tree.MessageTree" I only found how to use the DOM API, but is this also possible using your event API?
>
One can certainly parse header fields inside #field(Field rawField)
method either using field parsers from DOM module or using a custom
parser of some sort. Personally that is how I use mime4j.
Hope this helps
Oleg
> In any case many thanks for mime4j, it's a great library!
> Michael