Find an example of outputting a string to a file and find the code segment. No source code and Demonstration: source code packagemainimport (iconvgithub. comdjimeneziconv-runtime) funcmain () {log. SetFlags (log. LstdFlags | log. l1_file) resp, err: http. Get (ht)
Find an example of outputting a string to a file and find the code segment. No source code and demo: source code package mainimport (iconv "github.com/djimenez/iconv-go" "io/ioutil" "log" "net/http") func main () {log. setFlags (log. lstdFlags | log. lw.file) resp, err: = http. get ("ht
Find an example of outputting a string to a file and find the code segment. <无>
Source code and demo:Source code
package mainimport ( iconv "github.com/djimenez/iconv-go" "io/ioutil" "log" "net/http" )func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) resp, err := http.Get("http://data.earthquake.cn/datashare/globeEarthquake_csn.html") if err != nil { log.Fatal(err) } defer resp.Body.Close() input, err := ioutil.ReadAll(resp.Body) out := make([]byte, len(input)) out = out[:] iconv.Convert(input, out, "gb2312", "utf-8") ioutil.WriteFile("out.html", out, 0644)}