Character encoding detection and conversion (Python, Bash)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

11 lines
215 B

#!/bin/bash
toenc=$1
fname="$2"
enc=`detect_encoding.py "$fname"`
echo "Encoding=$enc"
[ "$enc" != "None" ] && iconv -f $enc -t $toenc "$fname" -o "$fname.iconv" && mv "$2".iconv "$2" || rm -f "$2".iconv
exit 0