Skip to content

Instantly share code, notes, and snippets.

@rixtox
Last active May 11, 2016 15:28
Show Gist options
  • Save rixtox/4fbb3aa521b3f05e13ec to your computer and use it in GitHub Desktop.
Save rixtox/4fbb3aa521b3f05e13ec to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
SRC="."
else
SRC="$1"
fi
if [ -z "$2" ]; then
ENCODING="gb18030"
else
ENCODING="$2"
fi
if [ -z "$3" ]; then
DESTI="UTF-8"
else
DESTI="$3"
fi
mkdir -p "${SRC}/out"
find "${SRC}/"* -maxdepth 0 -type f -name "*.ass" -exec sh -c "iconv -f \"${ENCODING}\" -t \"${DESTI}\" \"{}\" > \"${SRC}/out/{}\" " \;
find * -maxdepth 0 -type f -name "*.ass" -exec file -i {} \;
find * -maxdepth 0 -type f -name "*.ass" -exec sh -c "iconv -f gb18030 -t UTF-8 \"{}\" > \"./out/{}\" " \;
# zh_CN: gb18030
# ja_JP: CP932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment