Skip to content

fix incorrect subject encoding#398

Open
DeltaLaboratory wants to merge 4 commits intomjl-:mainfrom
DeltaLaboratory:main
Open

fix incorrect subject encoding#398
DeltaLaboratory wants to merge 4 commits intomjl-:mainfrom
DeltaLaboratory:main

Conversation

@DeltaLaboratory
Copy link

When sending emails with multi-word non-ASCII subjects (Korean, Japanese, Chinese, etc.), spaces between words are lost. For example, "가장 높은 산, 가장 긴 강" becomes "가장높은산,가장긴강".

The problem is message/compose.go where each non-ASCII word is encoded separately, producing adjacent encoded-words like =?utf-8?q?word1?= =?utf-8?q?word2?=.
Per RFC 2047 Section 6.2, email clients ignore whitespace between adjacent encoded-words, causing spaces to disappear.

This commit fixes this issue by grouping consecutive non-ASCII words before encoding them as a single encoded-word. This preserves spaces inside the encoding. Also added line folding at 77 characters for both ASCII and non-ASCII text per RFC 822/2047, and preserved exact whitespace (trailing/multiple spaces) which was previously normalized.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant