I am trying to convert the encoding of the file, but the resulting file does not appear. The command from the console runs correctly.
func main() {
from := "WINDOWS-1251"
filename := "3_win1251.csv"
cmd := exec.Command("iconv", fmt.Sprintf("-f %s", from), fmt.Sprintf("-t UTF-8//TRANSLIT %s", filename), fmt.Sprintf("-o ./convert_%s", filename))
// command: /usr/bin/iconv -f WINDOWS-1251 -t UTF-8//TRANSLIT 3_win1251.csv -o ./convert_3_win1251.csv
log.Println(cmd.String())
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
log.Println(cmd.ProcessState)
}
result: exit status 0
and the lack of a file.
file: 3_win1251.csv
os: debian 11