rhomb
(Jan)
1
Good Morning everyone.
Yesterday we had a Problem with non UTF-8 Files in the Project (happened in accident).
So I wrote a small bash script that should do the trick. It recursively converts all .php files to UTF-8 encoding
Requirements:
Script:
for i in $(find -name '*.php');do encoding=$(file -bi $i | sed -e 's/.*[ ]charset=//'); iconv -f $encoding -t UTF-8 -o $i $i; done
Greetings
rho
julianm
(Julianmagnone)
2
Sorry, but it didn’t work for me. All the files ended with 0 byte after running the command. Fortunately I still have the backup.
samdark
(Alexander Makarov)
3
We have ready to use commands for it in Yii repo:
Whoa, dude … find has got this nifty -exec param. At least you could’ve used xargs 
rhomb
(Jan)
5
@DASourcerer
was really qnd and late at night…
@Samdark… wow didn’t know that, thanks for the hint