User Tools

Site Tools


info:script:iconv

Change Encoding with iconv

Convert Single File

iconv -f iso-8859-1 -t utf-8 -o OUTPUT.txt INPUT.txt

Converts INPUT.txt from iso-8859-1 to utf-8 and writes it to OUTPUT.txt.

Convert All Files in a Directory

for f in $(find . -type f)
do
  iconv -f iso-8859-1 -t utf-8 -o ${f}_$$_TEMP ${f} \
  && mv ${f}_$$_TEMP ${f}
done
info/script/iconv.txt · Last modified: 2013-02-04 23:17 (external edit)