url := "http://blub.org/b.html?v1=23&v2=bla&v=sdl+sdo";
surl := http.URLEscape(url);
fmt.Println(url);
fmt.Println(surl);
url2 := "http://это.порусс.ки/здесь.хтмл";
surl2 := http.URLEscape(url2);
fmt.Println(url2);
fmt.Println(surl2);
output:
http://blub.org/b.html?v1=23&v2=bla&v=sdl+sdo
http://blub.org/b.html%3fv1%3d23%26v2%3dbla%26v%3dsdl%2bsdo
http://это.порусс.ки/здесь.хтмл
http://%d1%8d%d1%82%d0%be.%d0%bf%d0%be%d1%80%d1%83%d1%81%d1%81.%d0%ba%d0%b8/%d0%b7%d0%b4%d0%b5%d1%81%d1%8c.%d1%85%d1%82%d0%bc%d0%bb
http.URLUnescape(url string) do it back.
Keine Kommentare:
Kommentar veröffentlichen