You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Markus Wiederkehr (JIRA)" <mi...@james.apache.org> on 2009/08/17 13:54:14 UTC

[jira] Created: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
---------------------------------------------------------------------------------

                 Key: MIME4J-138
                 URL: https://issues.apache.org/jira/browse/MIME4J-138
             Project: JAMES Mime4j
          Issue Type: Bug
    Affects Versions: 0.6
            Reporter: Markus Wiederkehr
             Fix For: 0.7


For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.

The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Created: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by Wim Jongman <wi...@gmail.com>.
Thanks for filing the bug.
Regards,

Wim

On Mon, Aug 17, 2009 at 1:54 PM, Markus Wiederkehr (JIRA) <
mime4j-dev@james.apache.org> wrote:

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an
> equals sign
>
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>             Fix For: 0.7
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it
> does not get decoded at all.
>
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies
> =?utf-8?Q?= as the encoded word which cannot be decoded.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Issue Comment Edited: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Nevin (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796164#action_12796164 ] 

Nevin edited comment on MIME4J-138 at 1/4/10 12:41 PM:
-------------------------------------------------------

There is an issue in the fix. 
   158              if ((!previousWasEncoded) || (!CharsetUtil.isWhitespace(separator)))
   159                   sb.append(separator);
   160              matcher.appendReplacement(sb, decoded);
   161              previousWasEncoded = true;

in funciton call matcher.appendReplacement( ), if the decoded contains "$", an exception will be thrown:
   java.lang.IllegalArgumentException: Illegal group reference 
        at java.util.regex.Matcher.appendReplacement(Matcher.java:706) 
        at org.apache.james.mime4j.codec.DecoderUtil.decodeEncodedWords(DecoderUtil.java:160) 

As described in java api doc, public Matcher appendReplacement(StringBuffer sb, String replacement):
     Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string. 

Here is the temporary fix between line 159 and line 160:
               decoded = decoded.replace("\\", "\\\\");
               decoded = decoded.replace("$", "\\$");

      was (Author: nevinguo):
    There is an issue in the fix. 
   158              if ((!previousWasEncoded) || (!CharsetUtil.isWhitespace(separator)))
   159                   sb.append(separator);
   160              matcher.appendReplacement(sb, decoded);
   161              previousWasEncoded = true;

in funciton call matcher.appendReplacement( ), if the decoded contains "$", an exception will be thrown:
   java.lang.IllegalArgumentException: Illegal group reference 
        at java.util.regex.Matcher.appendReplacement(Matcher.java:706) 
        at org.apache.james.mime4j.codec.DecoderUtil.decodeEncodedWords(DecoderUtil.java:160) 

As described in java api doc, public Matcher appendReplacement(StringBuffer sb, String replacement):
     Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string. 

Here is the temporary fix between line 159 and line 150:
               decoded = decoded.replace("\\", "\\\\");
               decoded = decoded.replace("$", "\\$");
  
> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Markus Wiederkehr (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796178#action_12796178 ] 

Markus Wiederkehr commented on MIME4J-138:
------------------------------------------

@Nevin: a unit test has already been committed to prove that this works. See MIME4J-142 and testEncodedTextMayContainDollarSign() in DecoderUtilTest.

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Aron Wieck (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12744492#action_12744492 ] 

Aron Wieck edited comment on MIME4J-138 at 8/18/09 6:17 AM:
------------------------------------------------------------

Attached svn diff and full DecoderUtil.java with the changes.

This differs from my previously uploaded RegexDecoderUtil.java in the following points:

- the regular expression pattern has been changed to be more tolerant on wrong encoding data. It now assumes that no "?" sign may be in the encoded word other than these four: =?charset?enc?text?=

- the log output now includes the encoded word again

- added comments

      was (Author: eunice):
    Attached svn diff and full DecoderUtil.java with the changes.

This differs from my previously uploaded RegexDecoderUtil.java in the following points:

- the regular expression pattern has been changed to be more tolerant on wrong encoding data. It now assumes that no "?" sign may be in the encoded word. 

- the log output now includes the encoded word again

- added comments
  
> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Aron Wieck (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aron Wieck updated MIME4J-138:
------------------------------

    Attachment: RegexDecoderUtil.java

Proposed fix using Regular Expression. The class RegexDecoderUtil only contains the 3 changed methods.

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Markus Wiederkehr (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Markus Wiederkehr resolved MIME4J-138.
--------------------------------------

    Resolution: Fixed

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Bernd Fondermann (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12744472#action_12744472 ] 

Bernd Fondermann commented on MIME4J-138:
-----------------------------------------

Hi Aron,

is there any change you can provide this as a diff patch?

You can create patches with "svn diff" on the command line or by using your favorite IDEs functionality.

Thanks!

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Assigned: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by Aron Wieck <aw...@crown.de>.
Hello Markus,

I attached another proposal to fix this issue using Regular  
expressions, this one passes all your test cases.

I sacrificed some log output, but that could easily be reintroduced.

Performance wise, I think in theory it should be slightly faster than  
the current version at the expense of the Patter.compile call on class  
loading, but in real world usage I do not expect a noticeable  
difference.

If you choose to use it, I'll volunteer to fix bugs in the future.


Aron

On 18.08.2009, at 00:13, Markus Wiederkehr (JIRA) wrote:

>     [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 
>  ]
>
> Markus Wiederkehr reassigned MIME4J-138:
> ----------------------------------------
>
>    Assignee: Markus Wiederkehr
>
>> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with  
>> an equals sign
>

[jira] Assigned: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Markus Wiederkehr (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Markus Wiederkehr reassigned MIME4J-138:
----------------------------------------

    Assignee: Markus Wiederkehr

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Markus Wiederkehr (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Markus Wiederkehr updated MIME4J-138:
-------------------------------------

    Attachment: mime4j-138.patch

I've been working on a regex based patch myself since yesterday.

Today I have incorporated some of Aron's ideas into my code. The result is mime4j-138.patch.

@All: please review

@Aron: contributions are always welcome of course, many thanks!

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Aron Wieck (JIRA)" <mi...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aron Wieck updated MIME4J-138:
------------------------------

    Attachment: DecoderUtil.java
                DecoderUtil.diff

Attached svn diff and full DecoderUtil.java with the changes.

This differs from my previously uploaded RegexDecoderUtil.java in the following points:

- the regular expression pattern has been changed to be more tolerant on wrong encoding data. It now assumes that no "?" sign may be in the encoded word. 

- the log output now includes the encoded word again

- added comments

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Nevin (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796511#action_12796511 ] 

Nevin commented on MIME4J-138:
------------------------------

I have tried the latest version from the svn, my testcases are passed now. 

The problem originated from the wrong DecoderUtil.java(old version) attached in this page.  

I guess MEMERJ-142 is also originated from the attached DecoderUtil.java.  

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Nevin (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796164#action_12796164 ] 

Nevin commented on MIME4J-138:
------------------------------

There is an issue in the fix. 
   158              if ((!previousWasEncoded) || (!CharsetUtil.isWhitespace(separator)))
   159                   sb.append(separator);
   160              matcher.appendReplacement(sb, decoded);
   161              previousWasEncoded = true;

in funciton call matcher.appendReplacement( ), if the decoded contains "$", an exception will be thrown:
   java.lang.IllegalArgumentException: Illegal group reference 
        at java.util.regex.Matcher.appendReplacement(Matcher.java:706) 
        at org.apache.james.mime4j.codec.DecoderUtil.decodeEncodedWords(DecoderUtil.java:160) 

As described in java api doc, public Matcher appendReplacement(StringBuffer sb, String replacement):
     Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string. 

Here is the temporary fix between line 159 and line 150:
               decoded = decoded.replace("\\", "\\\\");
               decoded = decoded.replace("$", "\\$");

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Aron Wieck (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12744754#action_12744754 ] 

Aron Wieck commented on MIME4J-138:
-----------------------------------

Great, your regex seems to be even more strict than my suggestion.

You do not use matcher.appendReplacement and matcher.appendTail, which seems to be better than using them for everything except the separator like I did.

So thumbs up for the patch from me.

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Bernd Fondermann (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12744508#action_12744508 ] 

Bernd Fondermann commented on MIME4J-138:
-----------------------------------------

thanks, looks like a proper patch. makes reviewing really easy. (others will judge whether to include it into the codebase, though.)

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MIME4J-138) DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign

Posted by "Stefano Bagnara (JIRA)" <mi...@james.apache.org>.
    [ https://issues.apache.org/jira/browse/MIME4J-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796170#action_12796170 ] 

Stefano Bagnara commented on MIME4J-138:
----------------------------------------

Nevin, there is no "appendReplacement" method call in the committed fix, so I guess you are referring to an older fix. If you have a string that show the problem I can add it to the test suite to prove that the bug does not exist anymore.

That said, FYI in Java 5 you can use Pattern.quote() to get an escaped version of the string (but there is no more need for escaping in the new code, so this is just for your interest).

> DecoderUtil.decodeEncodedWords() fails if encoded-text starts with an equals sign
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-138
>                 URL: https://issues.apache.org/jira/browse/MIME4J-138
>             Project: JAMES Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Markus Wiederkehr
>            Assignee: Markus Wiederkehr
>             Fix For: 0.7
>
>         Attachments: DecoderUtil.diff, DecoderUtil.java, mime4j-138.patch, RegexDecoderUtil.java
>
>
> For example "=?utf-8?Q?=20test?=" should be decoded as " test". Instead it does not get decoded at all.
> The problem is that DecoderUtil.decodeEncodedWords() falsely identifies =?utf-8?Q?= as the encoded word which cannot be decoded.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.