Converting a csv file to utf-8

Hi All

I am using the fopen and fgets function to open a csv file loop through the first few records and perform certain task…the problem is when my php script tries to open a non-utf-8 csv, it fails to read it…but if I convert that csv (using an editor) to utf-8 format then my php script works fine.

So what I was wondering is if there is anyway in php to check if a file is non utf-8, if so then convert the file to utf-8 so that I do not have to manually convert the character set.

Thanks for any inputs.