[ 
https://issues.apache.org/jira/browse/MIME4J-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14536486#comment-14536486
 ] 

Andreas Veithen commented on MIME4J-244:
----------------------------------------

In 0.7.2, soft line breaks and more specifically the sequence "=\r\n" are 
processed by the following piece of code, with {{b == '='}} and {{b2 == '\r'}}:

{code}
                    } else if (Character.isWhitespace((char) b2)) {
                        // soft line break
                        index = transfer(-1, buffer, index, to, true);
                        if (b2 != LF) {
                            blanks.append(b);
                            blanks.append(b2);
                        }
                    } else {
{code}

That looks broken to me because the code doesn't consume the LF character 
(which is what causes the problem on the next iteratation) and instead appends 
"=\r" to {{blanks}}.

This would mean that:

* The issue is not related to the space before the equal sign as suggested by 
the OP. AXIOM-467 actually provides evidence that this occurs regardless of the 
character preceding the soft line break.
* The {{lastWasCR}} problem described by Detelin Yordanov is not the root cause 
of the present issue. Indeed, when I debugged AXIOM-467, I didn't find any 
evidence for that.

> Cannot decode "quoted printable" encoded message which have space before 
> equal sign("=") in strict mode
> -------------------------------------------------------------------------------------------------------
>
>                 Key: MIME4J-244
>                 URL: https://issues.apache.org/jira/browse/MIME4J-244
>             Project: James Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>    Affects Versions: 0.7.2
>            Reporter: Detelin Hadzhiev
>             Fix For: 0.7.3, 0.8.0
>
>
> Lets assume that we a message encoded using "quoted printable" encoding  like 
> this:
> "text before eq sign =\r\n text after LF"
> When you try to decode it using QuotedPrintableInputStream in Strict Mode you 
> will get  following exception:
> java.io.IOException: Found LF without CR
>       at 
> org.apache.james.mime4j.codec.QuotedPrintableInputStream.read0(QuotedPrintableInputStream.java:195)
>       at 
> org.apache.james.mime4j.codec.QuotedPrintableInputStream.read(QuotedPrintableInputStream.java:317)
>       at 
> org.apache.james.mime4j.codec.QuotedPrintableInputStream.read(QuotedPrintableInputStream.java:302)
>       at 
> org.apache.james.mime4j.codec.QuotedPrintableInputStreamTest.read(QuotedPrintableInputStreamTest.java:199)
> The same is fine using SILENT mode.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to