Feeds:
Wpisy
Komentarze

Posts Tagged ‘utf-8’

#!/bin/bash
find $1 -type f ! -regex '.*/\.git/.*' ! -regex '.*/\.trac/.*' \
! -iname '*.gif' ! -iname '*.jpg' ! -iname '*.png' \
! -iname '*.psd' ! -iname '*.cur' ! -iname '*.zip' \
! -iname '*.js' -print \
| while read oldName
do
#jesli konwersja zwroci blad, to nie jest to plik ascii, wiec konwertujemy z iso na utf.
iconv -f ISO-8859-1 -t us-ascii ${oldName} >/dev/null 2>&1 \
|| (echo "${oldName}"; iconv -f iso-8859-2 -t utf-8 ${oldName} 1>tmpfile 2>err.txt; cp tmpfile "${oldName}")
done
rm tmpfile
[ ! -s err.txt ] && rm err.txt

Źródło: 1 i 2

Read Full Post »