Skip to content

Instantly share code, notes, and snippets.

@bneil
Last active September 12, 2019 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bneil/7cd9b33890da601dda082305f53816f3 to your computer and use it in GitHub Desktop.
Save bneil/7cd9b33890da601dda082305f53816f3 to your computer and use it in GitHub Desktop.
//Just note taking a problem as i keep getting an illegal byte string
f, err := os.Open("/tmp/extra/sample.csv")
check(err)
defer f.Close()
in, err := ioutil.ReadAll(f)
check(err)
out := make([]byte, len(in))
out = out[:]
_, _, err = iconv.Convert(in, out, "utf-8", "ascii")
check(err)
// ^ got that illegal byte string
err = ioutil.WriteFile("/tmp/extra/sample.csv2", out, 0644)
check(err)
@bneil
Copy link
Author

bneil commented Sep 12, 2019

This is me just saving some code that would be useful. Im basically giving up at this point and just installing the iconv cli tool since the byte stream isnt working right T_T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment