Created
November 20, 2012 22:14
-
-
Save JakobR/4121614 to your computer and use it in GitHub Desktop.
Convert text files from SJIS to UTF-8 recursively
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 | |
# Unarchive the zip with "The Unarchiver" (it allows to select the file name encoding) | |
# Code inspired by http://stackoverflow.com/questions/1182037/osx-change-file-encoding-iconv-recursive | |
find /path/to/unarchived/folder -name \*.txt -type f | \ | |
(while read file; do | |
echo "convert $file"; | |
mv "$file" "$file.original" | |
iconv -f SJIS -t UTF-8 "$file.original" > "$file" | |
rm "$file.original" | |
done) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment