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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Is there any limit on the maximum length of filename while sending attachments?

user6731020Jul 28 2015 — edited Aug 10 2015

Does it support more than 255 characters?

MIME spec says about encoded-word as:

An encoded-word may not be more than 75 characters long, including charset, encoding, encoded text, and delimiters. If it is desirable to encode more text than will fit in an encoded-word of 75 characters, multiple encoded-words (separated by CRLF SPACE) may be used.


But can we pass the encoded filename as shown below to avoid the extra new line, spaces generated by encodeText() API?

"=?utf-8?B or Q?long_encodedtext?=" [Instead of breaking it into multiple lines]


Eg:

filename="=?utf-8?B?w4DDgcOFw4bDgMOBw4XDhsOHw4jDicOKw4vDjMONw47Dj8OQw4DDgcOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlsOYw5nDmsObw5zDncOew5/DoMOhw6LDo8Okw6XDpsOnw6jDqcOqw6vDrMOtw67Dr8Oww7HDssOzw7TDtcO2w7jDucO6w7vDvMO9w77Dv8OAw4HDhcOGw4cuZG9j?="  [It works and the base64 is generated by custom code]


The following does not work and generated by MimeUtility.encodeText() API.

Content-Disposition: attachment; filename="=?utf-8?B?w4DDgcOFw4bDgMOBw4XDhsOHw4jDiQ==?=\

\

=?utf-8?B?w4rDi8OMw43DjsOPw5DDgMOBw4XDhsOH?=\

\

=?utf-8?B?w4jDicOKw4vDjMONw47Dj8OQw5HDksOT?=\

\

=?utf-8?B?w5TDlcOWw5jDmcOaw5vDnMOdw57Dn8Og?=\

\

=?utf-8?B?w6HDosOjw6TDpcOmw6fDqMOpw6rDq8Os?=\

\

=?utf-8?B?w63DrsOvw7DDscOyw7PDtMO1w7bDuMO5?=\

\

=?utf-8?B?w7rDu8O8w73DvsO/w4DDgcOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkC5kb2M=?="


Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 7 2015
Added on Jul 28 2015
3 comments
3,527 views