Stefano Bagnara wrote:
Rick McGuire ha scritto:
Shouldn't you be maintaining the check for the current encoding being "8bit" before changing this? This can remove the need for unnecessary encoding/decoding. In particular, the MIMEMessage class when it transmits attempts to determine the most optimal encoding based on the data. So, for example, a text part might be using a base64 encoding because it contains a high percentage of characters that would be encoded. Unconditionally forcing this to Q-P bypasses this optimization. And if the text is already in Q-P format, then this will force it to be decoded and reencoded again.
Rick

I saw your comment about the "8bit check", but I didn't see that check in the patch you submitted.

Can you check the JIRA issue?
I get to drag out one of my favorite quotes: "A man with one watch always knows what time it is, a man with two is never sure". The same thing applies to builds! The 8bit test was an improvement I added to the build version that was using the geronimo javamail, not the one I generated the patch from (sigh). Anyway, it was a simple change:
           // only convert if 8bit encoding is indicated
           String encoding = part.getEncoding();
           if (encoding != null && encoding.equals("8bit") {
// The content may already be in encoded the form (likely with mail created from a // stream). In that case, just changing the encoding to quoted-printable will mangle // the result when this is transmitted. We must first convert the content into its // native format, set it back, and only THEN set the transfer encoding to force the
               // content to be encoded appropriately.
               if (part.isMimeType("text/*")) {
part.setContent(part.getContent(), part.getContentType()); part.setHeader("Content-Transfer-Encoding", "quoted-printable"); part.addHeader("X-MIME-Autoconverted", "from 8bit to quoted-printable by "+getMailetContext().getServerInfo());
               } else {
// if the part doesn't contain text it will be base64 encoded. part.setContent(part.getContent(), part.getContentType());
                   part.setHeader("Content-Transfer-Encoding", "base64");
part.addHeader("X-MIME-Autoconverted", "from 8bit to base64 by "+getMailetContext().getServerInfo());
               }
           }


Rick





Thank you,
Stefano


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to