How to convert multiple ISO8859-1 to UTF-8
iconv
defaults to sending its output to stdout, which explains the behaviour of what you saw. You can direct the output to a file using the -o
option, but that will only generate a single output file, and probably won't help you update the files in place. Perhaps try something like this:
for file in *.sql; do
iconv -f ISO-8859-1 -t UTF-8 -o "$file".utf "$file" && mv "$file".utf "$file"
done
That will convert each file and store the result in a temporary file, moving it to the original file name if the conversion was successful.
It is also possible to use rsync to this task, with one advantage, you will keep a backup. If one of the converted files is already in the target codification you will mess it up.
rsync -va --iconv=iso88591,utf8 /source/latin1/ /destination/utf8/