Skip to content

net/url: URL.String URL encodes a valid IDN domain #23669

@apriendeau

Description

@apriendeau

What version of Go are you using (go version)?

1.9.3

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/austin/Go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/austin/Go"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2m/fhmql6f10134630h6j10xgdh0000gn/T/go-build605073144=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

url.String is URL escaping valid IDN domains and not rendering them correctly. I passed in https://✪.random.url/1234 to url.Parse then ran u.String() and it encodes the subdomain which is a Unicode character. This can be any Unicode character.

https://play.golang.com/p/Kwlrvoghy31

What did you expect to see?

https://✪.random.url/1234

What did you see instead?

https://%E2%9C%AA.random.url/1234

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions