-2
我想轉換網址FE:Golang如何將punycode轉換爲unicode?
xn--h1aaebtrh5b.xn--p1ai --> кисточки.рф
當然和反向:
kremlin.ru ---> xn--d1abbgf6aiiy.xn--p1ai
我嘗試使用IDNA包,但我無法導入供應商包IDNA
Link上doc: https://godoc.org/golang.org/x/net/idna#Profile.ToUnicode
嘗試導入:
import "golang_org/x/net/idna"
得到錯誤:
main.go:18:8: cannot find package "golang_org/x/net/idna" in any of:
/usr/local/go/src/golang_org/x/net/idna (from $GOROOT)
/home/arseny/go/src/golang_org/x/net/idna (from $GOPATH)
闖闖:
import "vendor/golang_org/x/net/idna"
錯誤:
main.go:18:8: must be imported as golang_org/x/net/idna
main.go:19:2: use of vendored package not allowed
你爲什麼要導入'golang_org/x/net/idna'?該軟件包被稱爲'golang.org/x/net/idna'。 – Flimzy
是和否,在IDE Goglang中,此文件夾調用golang_org – Arseny
爲什麼-1 ???奇怪的人...... 在js中同樣quastion https://stackoverflow.com/questions/183485/converting-punycode-with-dash-character-to-unicode?rq=1 – Arseny