这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@iredmail
Copy link
Contributor

Since utf-7 is normal and not just used by one country, i suggest we support it in go-message.

@emersion
Copy link
Owner

UTF-7 is not just a subset of UTF-8. To support it, a real decoder is necessary.

https://datatracker.ietf.org/doc/html/rfc2152

@iredmail
Copy link
Contributor Author

iredmail commented Oct 14, 2021

My mistake, sorry.
Since go-imap supports utf-7, can we use same code in go-message?
https://github.com/emersion/go-imap/tree/master/utf7

@emersion
Copy link
Owner

go-imap supports a modified version of UTF-7, defined by the IMAP RFC. Maybe it can be adapted.

But I'd rather not add it built-in to go-message, I'd rather let users manually set CharsetReader to a function which handles UTF-7 if so they wish.

@iredmail
Copy link
Contributor Author

Disagree.

Since utf-7 is not used by only one language (e.g. Chinese, Korean, Japanese), it's better make it a built-in support to benefit all go-message users. :)

@emersion
Copy link
Owner

go-message has no built-in charset support apart from utf-8 and ascii. utf-7 is no different than say gbk or shift-jis.

@iredmail iredmail closed this Oct 14, 2021
@iredmail
Copy link
Contributor Author

Thanks for the explanation.

@Vovan-VE
Copy link

Vovan-VE commented Nov 7, 2024

Just in case if somebody will need it:

package charset

import (
	"github.com/cention-sany/utf7"
	"github.com/emersion/go-message/charset"
)

func init() {
	charset.RegisterEncoding("utf7", utf7.UTF7)
	charset.RegisterEncoding("utf-7", utf7.UTF7)
}

then import it instead of _ "github.com/emersion/go-message/charset":

 import (
-	_ "github.com/emersion/go-message/charset"
+	_ ".../charset"
 )

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.

3 participants