Skip to content

Instantly share code, notes, and snippets.

@edi33416
Last active November 30, 2021 14:07
Show Gist options
  • Save edi33416/834336a6866715088af2e603dfac4c01 to your computer and use it in GitHub Desktop.
Save edi33416/834336a6866715088af2e603dfac4c01 to your computer and use it in GitHub Desktop.
Convert Windows UTF-16LE to UTF-8
#!/bin/bash
is_on_windows=1
if [ is_on_windows -eq 1]; then
for i in *.csv; do
powershell.exe -Command "Get-Content \"$i\" -Encoding Unicode | Set-Content -Encoding UTF8 \"r_$i\""
done
else
mkdir utf-8
for i in *.csv; do
iconv -f utf-16 -t utf-8 < $i > utf-8/$i;
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment