I am trying to load a bunch of csv files into a database. Parsing the files and entering the data is all working great.....except some of the files encoding is giving me trouble.
UTF-8 files work fine and most files are this format. However some of the files are in ASCII and these files do not load properly.
Is there a way to check the file itself for its encoding, and convert the encoding before using the data? I have been playing with mb_convert_encoding and iconv but these all take a string as input. would rather check the file and convert right off the bat instead of checking it line by line as I take in the data.
Thank you.