Skip to content

Instantly share code, notes, and snippets.

@JakobR
Created November 20, 2012 22:14
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 JakobR/4121614 to your computer and use it in GitHub Desktop.
Save JakobR/4121614 to your computer and use it in GitHub Desktop.
Convert text files from SJIS to UTF-8 recursively
#!/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