Go version
go1.22.4 darwin/arm64
Output of go env
in your module/workspace:
GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/maksymbosik/Library/Caches/go-build'
GOENV='/Users/maksymbosik/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/maksymbosik/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/maksymbosik/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/maksymbosik/IdeaProjects/go-examples/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/k8/1scngq9j4rz46np16jktyh5w0000gn/T/go-build1752497717=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
func main() {
address, err := mail.ParseAddress("foo@bar.com×")
if err != nil {
fmt.Printf("invalid %s", err)
} else {
fmt.Printf("valid %s", address.String())
}
}
https://go.dev/play/p/OAhGOzjsQAa
What did you see happen?
Email contains U+00D7 https://en.wikipedia.org/wiki/Multiplication_sign -> it is not an x-× Actual output : valid foo@bar.com× It is unquoted character and not allowed special character.
What did you expect to see?
Expected output: err should return with invalid email
Comment From: gabyhelp
Related Issues
- mail.ParseAddress("145175208@qq") return a valid result #45056 (closed)
- net/mail Error while parsing an email address with string literal(\n) inside a quoted string #39856 (closed)
- net/mail: wrong error message for ParseAddress(`John "Doe \<john@example.com>`) #19447 (closed)
- net/mail: ParseAddress cannot parse email address with name contains chinese character #36200 (closed)
- net/mail: mail.ParseAddress() does not handle comments correctly #38447
- net/mail: address parsing fails when name contains '@' #66447 (closed)
- net/mail: ParseAddress doesn't support using a domain-literal in the domain of an email address #60206 (closed)
- proposal: net/mail: allow AddressParser helper code to signal invalid character set #41625 (closed)
- net/mail: ParseAddress() accepts valid RFC 5322 addresses with domain part starting with a dash which are invalid RFC 1035 addresses, should we tighten the permissive validation? #39488
- net/mail: ParseAddress/String corrupt address #11292 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: seankhliao
net/mail
specifies that it is RFC 5322 and extended by RFC 6532.
The preceding changes mean that the following constructs now allow UTF-8: ... 4. Domains.
Closing as working as intended.
Comment From: maksymbosik
Thank you for answer, oh there is extension to that RFC, sorry for bothering.