Closed loveyu233 closed 2 months ago
The file name is garbled in Chinese, and the file content is not garbled in Chinese
func TestAl(t *testing.T) { contents := []byte("Hello World") fzip, err := os.Create(./test.zip) if err != nil { log.Fatalln(err) } zipw := zip.NewWriter(fzip)
./test.zip
defer zipw.Close() w, err := zipw.Encrypt("乱码.txt", `golang`) if err != nil { log.Fatal(err) } var buffer bytes.Buffer buffer.Write(contents) _, err = io.Copy(w, bytes.NewReader(buffer.Bytes())) if err != nil { log.Fatal(err) } zipw.Flush()
}
func TestAl(t *testing.T) { contents := []byte("Hello World") fzip, err := os.Create(
./test.zip
) if err != nil { log.Fatalln(err) } zipw := zip.NewWriter(fzip)}