Initial commit

master
Kolan Sh 11 years ago
commit 061d1ff95d

@ -0,0 +1,12 @@
#!/usr/bin/python
import sys
import glob
from chardet.universaldetector import UniversalDetector
detector = UniversalDetector()
detector.reset()
contents=file(sys.argv[1], 'rb').read()
detector.feed(contents)
detector.close()
print detector.result['encoding']

@ -0,0 +1,11 @@
#!/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
Loading…
Cancel
Save