, "file -bi" "iconv -f ISO-8859-1 -t UTF-8".
. ISO-8859-1, UTF-8 ASCII. , wile , , , , .
Perl, UTF-8 ISO-8859-1, UTF-8.
, , , ( - , 1-2 ISO-8859-1)
№1 ISO-8859-1 UTF-8
cat mixed_text.txt |
while read i do
type=${"$(echo "$i" | file -bi -)"#*=}
if [[$ type == 'iso-8859-1']]; then
echo "$ i" | iconv -f ISO-8859-1 -t UTF-8
else
echo "$ i"
fi
done> utf8_text.txt
Option No. 2 is converted to ISO-8859-1 in ASCII
cat mixed_text.txt |
while read i do
type = $ {"$ (echo" $ i "| file -bi -)" # * =}
if [[$ type == 'iso-8859-1']]; then
echo "$ i" | iconv -f ISO-8859-1 -t ASCII // TRANSLIT
else
echo "$ i"
fi
done> utf8_text.txt
source
share