Last active
November 30, 2021 14:07
-
-
Save edi33416/834336a6866715088af2e603dfac4c01 to your computer and use it in GitHub Desktop.
Convert Windows UTF-16LE to UTF-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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