I have been given an excel file to read into a database that needs serious cross table referencing for validation. The client absolutely cannot be trusted, so I need a bulletproof system of checking for encoding of the supplied csv and encryption
into the utf8 to match the database.
Import the csv.
Check the csv encoding.
Change the encoding IF NECESSARY.
write to array
loop throught the array, validate the fields and write to screen grid showing validation errors. Rows that fail validation are able to be edited in the screen and submission is able to be tried again.
The problem is that I cannot get past the write toarray unless the file provided is UTF8, as the norwegian special characters seem to break the toArray function a little. Basically, everytime I reach a special character, the rest of the row is ignored.
So once I have loaded the CSV into a PHPObject worksheet, I need to know what encoding it uses and convert it without damaging it. Yes, they should just supply it in the utf8 format, but we all know that clients are not to be trusted, and they also can't
control the actions of their staff.
What do you think? Is this easy, or do I have to open the file with native php functions and convert the string before I give it to PHPExcel?
Much appreciate the reading, hope to hear from someone soon.