Skip to content

Conversation

@youkidearitai
Copy link
Contributor

Closes: #20674

In RFC2047

An 'encoded-word' may not be more than 75 characters long, including
'charset', 'encoding', 'encoded-text', and delimiters. If it is
desirable to encode more text than will fit in an 'encoded-word' of
75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may
be used.

?= =? is skipped if long term, so skip space character.

cc: @alexdowad

`?=  =?` is skipped if long term, so skip space character.
@alexdowad
Copy link
Contributor

@youkidearitai, thanks very much for working on this issue!

My understanding of RFC 2047 was that when performing encoding of a non-ASCII string into "encoded words", the encoder should put CR + LF + space (in that order) between each encoded word.

However, the reporter of GH 20674 says that iconv decodes MIME encoded words in the way which he is requesting.

I also just checked what Python's email.header library does, and it also does the same thing which is requested in GH 20674.

@alexdowad
Copy link
Contributor

Looks great. Many thanks to @youkidearitai

See: https://www.ietf.org/rfc/rfc2047#section-8
And fix (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=) as (a b).
@youkidearitai
Copy link
Contributor Author

I found a bug, so fix it.

var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?=  =?ISO-8859-1?Q?b?=)"));

Last result is (a b ), RFC 2047 example is (a b).

@alexdowad
Copy link
Contributor

I found a bug, so fix it.

var_dump(mb_decode_mimeheader("(=?ISO-8859-1?Q?a?=  =?ISO-8859-1?Q?b?=)"));

Last result is (a b ), RFC 2047 example is (a b).

Awesome! Thank you!!

I noticed that RFC 2047 contains 7 test cases in section 8, and you brought 6 of those test cases into the PHP test suite... could we use all 7 of them?

@youkidearitai
Copy link
Contributor Author

@alexdowad Thank you! I got it. I deleted duplicate test cases.

@alexdowad
Copy link
Contributor

😅 Sorry that my comment maybe wasn't very clear.
I was suggesting that since RFC 2047 has provided 7 "official" test cases, it would be good to use all of those official test cases in the PHP test suite.
(RFCがせっかくに七つのテストケースを提供してくれたので、それを全部活用した方が良いではないかという提案でした。でも、浜田さんがここまで頑張ってくださったので、今のままにPRをマージしたいと思われたら、僕が別個のPRで追加させていただいても構いません。🙇🏻‍♂️)

@youkidearitai
Copy link
Contributor Author

Thank you. I see. Added😊.

(ありがとうございます、承知しました。追加しなおしますね😊)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants