emersion / go-message

✉️ A streaming Go library for the Internet Message Format and mail messages
MIT License
382 stars 111 forks source link

Support utf-7. #142

Closed iredmail closed 2 years ago

iredmail commented 2 years ago

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

emersion commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Thanks for the explanation.