Return-Path: X-Original-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Delivered-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA28D7A00 for ; Tue, 13 Dec 2011 17:46:22 +0000 (UTC) Received: (qmail 81112 invoked by uid 500); 13 Dec 2011 17:46:22 -0000 Delivered-To: apmail-james-mime4j-dev-archive@james.apache.org Received: (qmail 81047 invoked by uid 500); 13 Dec 2011 17:46:22 -0000 Mailing-List: contact mime4j-dev-help@james.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mime4j-dev@james.apache.org Delivered-To: mailing list mime4j-dev@james.apache.org Received: (qmail 81038 invoked by uid 99); 13 Dec 2011 17:46:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2011 17:46:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2011 17:46:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8648223888E7; Tue, 13 Dec 2011 17:45:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1213804 - in /james/mime4j/trunk/core/src: main/java/org/apache/james/mime4j/codec/DecoderUtil.java test/java/org/apache/james/mime4j/codec/DecoderUtilTest.java Date: Tue, 13 Dec 2011 17:45:52 -0000 To: mime4j-dev@james.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111213174552.8648223888E7@eris.apache.org> Author: olegk Date: Tue Dec 13 17:45:52 2011 New Revision: 1213804 URL: http://svn.apache.org/viewvc?rev=1213804&view=rev Log: MIME4J-209: Regex pattern used by DecoderUtil disallowed question mark in the encoded text Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/DecoderUtilTest.java Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java?rev=1213804&r1=1213803&r2=1213804&view=diff ============================================================================== --- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java (original) +++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/codec/DecoderUtil.java Tue Dec 13 17:45:52 2011 @@ -35,7 +35,7 @@ import org.apache.james.mime4j.util.Char public class DecoderUtil { private static final Pattern PATTERN_ENCODED_WORD = Pattern.compile( - "(.*?)=\\?([^\\?]+?)\\?(\\w)\\?([^\\?]+?)\\?=", Pattern.DOTALL); + "(.*?)=\\?(.+?)\\?(\\w)\\?(.+?)\\?=", Pattern.DOTALL); /** * Decodes a string containing quoted-printable encoded data. Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/DecoderUtilTest.java URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/DecoderUtilTest.java?rev=1213804&r1=1213803&r2=1213804&view=diff ============================================================================== --- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/DecoderUtilTest.java (original) +++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/codec/DecoderUtilTest.java Tue Dec 13 17:45:52 2011 @@ -107,6 +107,11 @@ public class DecoderUtilTest extends Tes assertEquals("variable ${target.nl}", DecoderUtil.decodeEncodedWords("=?utf-8?Q?variable=20${target.nl}?=")); } + // see MIME4J-209 + public void testEncodedTextMayContainQuestionMark() { + assertEquals("?", DecoderUtil.decodeEncodedWords("=?ISO-8859-1?Q???=")); + } + public void testNonWhiteSpaceBetweenEncodedWordsIsRetained() { assertEquals("a b c", DecoderUtil.decodeEncodedWords("=?ISO-8859-1?Q?a?= b =?ISO-8859-1?Q?c?=")); assertEquals("a\rb\nc", DecoderUtil.decodeEncodedWords("=?ISO-8859-1?Q?a?=\rb\n=?ISO-8859-1?Q?c?="));