eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
386 stars 144 forks source link

MimeUtility.decodeText does not properly decode text in parentheses #2330

Closed glassfishrobot closed 17 years ago

glassfishrobot commented 17 years ago

MimeUtility.decodeText() does not properly decode the ASCII string:

(=?ISO-8859-1?Q?a?=)

In the examples given on page 11 of RFC 2047, it is clearly stated that this should be decoded to "(a)". The wording in the RFC is confusing, and I honestly can't say where this is and where this isn't allowed. But using Apple Mail as a reference implementation, the given ASCII string is decoded when used as the subject header.

Environment

Operating System: All Platform: All

Affected Versions

[9.0pe]

glassfishrobot commented 6 years ago
glassfishrobot commented 17 years ago

@glassfishrobot Commented @bshannon said: The two cases you're considering are quite different.

The "From" header field contains structured text, which allows comments that may contain unstructured text. The parens delimit the comment text, but are not part of the comment text.

The "Subject" header field contains unstructured text. Any parens in the Subject field are part of the text.

The MIME spec is clear that these encoded strings must be "words" in unstructured text - that is, they must be separated by whitespace or the beginning or end of the field.

You can set the "mail.mime.decodetext.strict" System property to "false" to cause JavaMail to decode more of these incorrectly encoded fields.

Whatever application created the header field you're trying to decode is incorrectly encoding the field. You should report this bug to the owner of that application.

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-2330

glassfishrobot commented 17 years ago

@glassfishrobot Commented Reported by catalla_jc

glassfishrobot commented 17 years ago

@glassfishrobot Commented Marked as incomplete on Monday, February 5th 2007, 8:34:23 am