Skip to content

Instantly share code, notes, and snippets.

@themactep
Created March 8, 2023 19:52
Show Gist options
  • Save themactep/2296eed28d2c32eede20aeb306bde92b to your computer and use it in GitHub Desktop.
Save themactep/2296eed28d2c32eede20aeb306bde92b to your computer and use it in GitHub Desktop.
#!/bin/sh
# Convert text from GB 2312 charset to Unicode, translate to English.
# cn2en.sh <file.txt>
# Paul Philippov <[email protected]>
# 20200926
infile=$1
cnfile="${infile%.*}.cn.${infile##*.}"
enfile="${infile%.*}.en.${infile##*.}"
cat "$infile" | iconv -f gb2312 -t utf8 - > "$cnfile"
trans -brief zh:en < "$cnfile" > "$enfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment