encoding_test.go 591 B

12345678910111213141516171819
  1. package encoding
  2. import (
  3. "github.com/flashmob/go-guerrilla/mail"
  4. "strings"
  5. "testing"
  6. )
  7. // This will use the golang.org/x/net/html/charset encoder
  8. func TestEncodingMimeHeaderDecode(t *testing.T) {
  9. str := mail.MimeHeaderDecode("=?ISO-2022-JP?B?GyRCIVo9dztSOWJAOCVBJWMbKEI=?=")
  10. if i := strings.Index(str, "【女子高生チャ"); i != 0 {
  11. t.Error("expecting 【女子高生チャ, got:", str)
  12. }
  13. str = mail.MimeHeaderDecode("=?ISO-8859-1?Q?Andr=E9?= Pirard <[email protected]>")
  14. if strings.Index(str, "André Pirard") != 0 {
  15. t.Error("expecting André Pirard, got:", str)
  16. }
  17. }