http://osdir.com/ml/linux.debian.internationalization.general/2003-01/msg00011.html
How about trying iconv? If it is not intended encoding, it errors.
For example, if
iconv -f UTF-8 -t ISO-8859-1 <somefile
succeeds, it means the file is UTF-8. Thus, I wrote the following script:
#!/bin/sh
if iconv -f UTF-8 -t UTF-8 <$1 &>/dev/null
then
echo UTF-8
else
echo ISO-8859-1
fi
---
Tomohiro KUBOTA <kubota@xxxxxxxxxx>
http://www.debian.or.jp/~kubota/
How about trying iconv? If it is not intended encoding, it errors.
For example, if
iconv -f UTF-8 -t ISO-8859-1 <somefile
succeeds, it means the file is UTF-8. Thus, I wrote the following script:
#!/bin/sh
if iconv -f UTF-8 -t UTF-8 <$1 &>/dev/null
then
echo UTF-8
else
echo ISO-8859-1
fi
---
Tomohiro KUBOTA <kubota@xxxxxxxxxx>
http://www.debian.or.jp/~kubota/