james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artur Jablonski (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] [Commented] (MIME4J-263) DecoderUtil.decodeEncodedWords() doesn't decode an encoded empty string
Date Fri, 18 Aug 2017 09:35:00 GMT

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

Artur Jablonski commented on MIME4J-263:
----------------------------------------

I've seen there's a comment in unit tests that the rfc2047 requires at least one character...
still. I'd say it makes sense to decode such strings to empty string. 


> DecoderUtil.decodeEncodedWords() doesn't decode an encoded empty string
> -----------------------------------------------------------------------
>
>                 Key: MIME4J-263
>                 URL: https://issues.apache.org/jira/browse/MIME4J-263
>             Project: James Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>            Reporter: Artur Jablonski
>            Priority: Minor
>
> {{DecoderUtil.decodeEncodedWords()}} returns an unencoded string if the word to decode
is empty.
> For example
> {{DecoderUtil.decodeEncodedWords("=?utf-8?Q??=", DecodeMonitor.SILENT)}}
> returns
> {{"=?utf-8?Q??="}}
> instead of empty string (or perhaps null)
> The problem lies in the regexp that is used behind the scenes that requires at least
one character:
> {code}
> private static final Pattern PATTERN_ENCODED_WORD = Pattern.compile(
>             "(.*?)=\\?(.+?)\\?(\\w)\\?(.+?)\\?=", Pattern.DOTALL);
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message