Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to decode attachment filename with character set and continuation?

843834Jul 7 2008 — edited Aug 4 2008
Hello,

I have a mail with attachments using non-ascii characters in their filenames; if the filenames are rather long, it results in parameter continuation as specified in RFC 2231.
When using the method part.getFilename() on such a Part, it returns null - which leaves me with nothing to decode or whatever.
Reading the filenames and putting them together in a string did not help as well - at least MimeUtility.decodeWord() or .decodeText() don't do anything like they do with a parameter like filename="=?ISO-8859-15?Q?K=F6hler_29=2E04=2E08=2Epdf?=".

The header which I'd like to decode looks like this:

--------------090603080701060002010801
Content-Type: application/octet-stream;
name*0*=ISO-8859-15''%42%52%48%2D%42%65%72%69%63%68%74%20%6E%61%63%68%20;
name*1*=%A7%38%38%28%32%29%42%48%4F%20%49%54%2D%57%69%72%74%73%63%68%61;
name*2*=%66%74%6C%69%63%68%6B%65%69%74%73%62%65%74%72%61%63%68%74%75%6E;
name*3*=%67%65%6E%20%56%49%49%32%2D%32%30%30%34%2D%31%33%31%37%38%20%76;
name*4*=%2E%20%31%39%2E%30%36%2E%30%38%2E%70%64%66
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename*0*=ISO-8859-15''%42%52%48%2D%42%65%72%69%63%68%74%20%6E%61%63%68;
filename*1*=%20%A7%38%38%28%32%29%42%48%4F%20%49%54%2D%57%69%72%74%73%63;
filename*2*=%68%61%66%74%6C%69%63%68%6B%65%69%74%73%62%65%74%72%61%63%68;
filename*3*=%74%75%6E%67%65%6E%20%56%49%49%32%2D%32%30%30%34%2D%31%33%31;
filename*4*=%37%38%20%76%2E%20%31%39%2E%30%36%2E%30%38%2E%70%64%66

...continued with the binary content...



Can anybody please help?

Regards,
Karsten
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 1 2008
Added on Jul 7 2008
12 comments
1,417 views