Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/url: URL.String() escapes Unicode domain #65999

Closed
sollniss opened this issue Feb 28, 2024 · 3 comments
Closed

net/url: URL.String() escapes Unicode domain #65999

sollniss opened this issue Feb 28, 2024 · 3 comments

Comments

@sollniss
Copy link

Go version

go version go1.22.0 windows/amd64

Output of go env in your module/workspace:

GO111MODULE=
GOARCH=amd64
GOBIN=
GOCACHE=C:\Users\solln\AppData\Local\go-build
GOENV=C:\Users\solln\AppData\Roaming\go\env
GOEXE=.exe
GOEXPERIMENT=
GOFLAGS=
GOHOSTARCH=amd64

What did you do?

https://go.dev/play/p/sDjQRu9ElyH

What did you see happen?

http://%E3%81%82%E3%81%84%E3%81%86.com/

What did you expect to see?

http://あいう.com/
or
http://xn--l8jeg.com/

@sollniss
Copy link
Author

Not sure if escaped by design, since there was no mention of it in #30922.
However, the docs say "String reassembles the [URL] into a valid URL string" and escaped hostnames/domains are not RFC conform.

@cagedmantis
Copy link
Contributor

https://pkg.go.dev/net/url#URL.String States that "Any non-ASCII characters in host are escaped." This is working as intended.

I'm going to close this issue. Please feel free to reopen it if you believe this was closed in error.

@seankhliao
Copy link
Member

percent encoded hostnames are rfc conformant to https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2

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

No branches or pull requests

3 participants